Skip to main content

Module oms

Module oms 

Source
Available on crate feature oms only.
Expand description

OMS security (feature oms): keys and the AES primitives of security modes 5 and 7 and the ELL (OMS Vol. 2, EN 13757-7).

LayerCipherVerified by
TPL, mode 5AES-128-CBC, IV = M ‖ A ‖ 8 × access number2F 2F after decryption
TPL, mode 7AES-128-CBC, IV = 0, key derived per message (CMAC KDF)AFL CMAC (and 2F 2F)
TPL, mode 10AES-128-CCM, nonce = M ‖ A ‖ 00 ‖ counter, key derived per messageCCM tag (authenticates)
ELL (CI 8D/8F)AES-128-CTR, IV = M ‖ A ‖ CC ‖ SN ‖ FN ‖ BCpayload CRC

Keys are the caller’s: Key holds one, erases it on drop and never shows it in Debug. Keys is how the library asks for the key of a meter; implement it for a key store, or use a single Key or a slice of (Address, Key) pairs.

Only mode 7 with a verified CMAC and mode 10 authenticate a telegram. Mode 5 and the ELL give confidentiality only: 2F 2F and the payload CRC detect a wrong key, not tampering. Both are malleable without the key (CBC through the IV inputs in the header, CTR with a recomputed CRC), and a fleet-wide key lets its holders send anything (Authenticity).

Structs§

Key
A 128-bit AES key. Erased from memory when dropped; never printed.

Traits§

Keys
Where the library gets the key for a meter.