Documentation

How to read, verify, sign and transport OCMF records with the ocmf crate — from a first parse to a full transparency container.

OCMF — the Open Charge Metering Format — is the container a certified meter in an EV charging station puts a reading into and signs, so that a driver can check months later that the kilowatt-hours on the invoice are the kilowatt-hours the meter measured. One record is one line of text:

OCMF|{…payload JSON…}|{…signature JSON…}

ocmf is an independent Rust implementation of that format. It reads records deployed meters actually emit, says exactly how they depart from the specification, verifies them against every algorithm the specification defines, and builds and signs new ones the same way.

If you are new here, read Getting started and then The signed-bytes rule — the second one explains a constraint that every other page assumes.

Getting started Install the ocmf crate or the command-line tool, parse your first record, and check a signature. The signed-bytes rule Why an OCMF signature covers the payload exactly as written, what that forbids, and how the section scanner finds the span without splitting on the pipe. Reading records The payload: fields, readings, carry-forward resolution, OBIS codes, exact decimals and the welded timestamp field. Deviations and profiles How ocmf reports departures from the OCMF specification: the Departure classes, the full DeviationKind catalogue, and the three parsing profiles. Verifying Check an OCMF signature: reading public keys in six shapes, all seven ECDSA algorithms, the pure-Rust and OpenSSL backends, and what each error actually means. Signing Build and sign OCMF records in Rust: RFC 6979 deterministic ECDSA, an HSM seam, derived format versions, and a builder that refuses to emit what it cannot read back. Sessions Check a whole charging transaction: continuous pagination, one begin and one end, one source, error states fatal — every rule OCMF assigns to a check component. Transports Move an OCMF record: the OCPP SignedMeterValueType container with its oca: public-key composition, and the S.A.F.E. transparency XML a driver checks a bill with. CLI reference The ocmf command: explain, verify, session, sign, to-xml, to-ocpp, from-ocpp, conformance and curves. Conformance suite A published OCMF conformance suite: 163 records with stated expected outcomes, meant to be run by any implementation in any language. Feature flags and no_std Cargo features for the ocmf crate, the embedded build, the dependency budget, and the supported Rust version. FAQ Common questions about OCMF and the ocmf Rust crate: what the format is, what a signature proves, why records must not be re-serialised, and how it relates to OCPP and Eichrecht.