Expand description
Elliptic-curve key agreement for security suites 1 and 2 (IEC 62056-5-3, 5.3.4 / DLMS Green Book Annex C).
Two parties derive a shared symmetric key from a static/ephemeral EC key pair
each. The raw shared secret Z is the x-coordinate of the ECDH point
(FE2OS(x)); it is then run through the NIST SP 800-56A single-step (concat)
KDF to obtain the DLMS session key:
K = Hash( counter(0x00000001) ‖ Z ‖ AlgorithmID ‖ PartyUInfo ‖ PartyVInfo )where the hash is SHA-256 for suite 1 and SHA-384 for suite 2, PartyUInfo /
PartyVInfo are the two system-titles, and the encryption key is the leftmost
16 (suite 1) or 32 (suite 2) octets of K. Validated against the One-Pass
Diffie-Hellman test vector of DLMS Green Book Table C.2.
Enums§
- Agreement
Error - Errors from key agreement.
Functions§
- agree_
key - Performs the full DLMS key agreement: ECDH followed by the KDF, returning the derived AES encryption key (16 octets for suite 1, 32 for suite 2).
- coord_
len 🔒 - Coordinate length (octets) of the suite’s curve.
- ecdh
- Computes the raw ECDH shared secret
Z = FE2OS(x)between ourprivate_key(raw scalar) and the peer’spublic_key(rawx ‖ yor SEC1) on the suite’s curve. - kdf
- The NIST SP 800-56A single-step KDF over the suite’s hash, producing
output_lenoctets from the shared secretzand the other-info fieldsalgorithm_id ‖ party_u_info ‖ party_v_info. - originator_
agree - The originator side of a One-Pass Diffie-Hellman agreed-key exchange (C(1e, 1s), IEC 62056-5-3 Annex C.2).
- public_
key - Derives the ephemeral public key (
FE2OS(x) ‖ FE2OS(y)) from an ephemeral private key on the suite’s curve, for embedding as key-ciphered-data. - recipient_
agree - The recipient side of a One-Pass Diffie-Hellman agreed-key exchange.
- to_sec1 🔒
- Normalizes a public key to SEC1 uncompressed form (
0x04 ‖ x ‖ y).