Open Charging Technology · Whitepapers

Test vectors for signed OCPP messages

Status: test data for section 4 of Signed OCPP Messages and Signer Roles (version 0.1, draft): the protected header in the embedded form (section 4.2, encoding 2).

signed-messages-vectors.json is generated by ../tools/generate-test-vectors.mjs. The generator shares no code with the reference implementation:

An implementation that passes the vectors canonicalizes, signs and checks like an independent one. To regenerate (Node.js 20 or newer, no packages):

node SignedMessages/tools/generate-test-vectors.mjs

ECDSA signatures are randomized, so every run writes other signature values. The keys are derived from fixed labels and stay the same.

What a vector holds

Field Meaning
frames OCPP-J frames as the verifier received them, in the order it received them. The payloads are written the way a peer may write them: members in another order, extra whitespace, and a field (vendorHint) that a Reset parser does not know.
request For a response: the request frame the verifier sent, with its signatures.
verifier The verifying node: nodeId, ocppVersion, the clock now (Unix seconds), acceptFormat0, and its rule (action, optionally key as the raw uncompressed point in hex).
expected.canonicalPayload The RFC 8785 form of the payload as received, without signatures: what the verifier computes. Where the payload was changed after signing, it differs from what was signed.
expected.signingInput protected '.' BASE64URL(canonicalPayload), the bytes ES256 is verified over.
expected.results One entry per frame: whether the message is accepted, and the status of its signature.

parameters holds maxClockSkew (300 s) and maxSignatureAge (900 s). keys holds the three test keys as JWK with d, as the raw point, and with their RFC 7638 thumbprint (kid).

A frame that arrives over a direct OCPP-J connection carries no destination. The verifying node is the destination, so OCPPDestination must name it.

The statuses

Status Meaning
ValidSignature Key, mathematics, header, time and freshness hold.
InvalidSignature The signature does not match the payload as received.
WrongFrame The signature is valid, but its header names another protocol version, message type, action, message id, destination, or (for a response) another request.
OutOfTime iat lies further in the future than maxClockSkew, or the validity has passed.
Replayed The pair of key and message id (or nonce) was accepted before.
UnknownSigner The rule names a key, and the signature was made with another one.
BrokenSignature The kid is not the thumbprint of the jwk the signature carries.

Who runs them