DES primitives for the NetMD secure session, matching the CryptoJS usage in netmd-js. All inputs must be multiples of the 8-byte DES block size; the reference relies on the same alignment.
Summary
Functions
Two-key triple-DES CBC encryption (the 16-byte key expands to K1 K2 K1).
Single-DES CBC decryption.
Single-DES CBC encryption.
Single-DES ECB decryption.
Single-DES ECB encryption.
Decrypt data from an encrypted factory memory transfer (block-aligned).
Encrypt data for an encrypted factory memory transfer.
The retail MAC used to derive the secure session key.
Functions
Two-key triple-DES CBC encryption (the 16-byte key expands to K1 K2 K1).
Single-DES CBC decryption.
Single-DES CBC encryption.
Single-DES ECB decryption.
Single-DES ECB encryption.
Decrypt data from an encrypted factory memory transfer (block-aligned).
Encrypt data for an encrypted factory memory transfer.
Matches the reference: PKCS7-pad to the DES block size, ECB-encrypt with the fixed factory key, then drop the trailing padding block. For block-aligned input (what the callers produce) this is plain ECB.
@spec retailmac(key :: <<_::128>>, value :: binary(), iv :: <<_::64>>) :: <<_::64>>
The retail MAC used to derive the secure session key.
DES-CBC over all but the last 8 bytes of value with the first half of
key produces an intermediate IV; triple-DES-CBC over the final 8
bytes with the full key produces the MAC (first 8 bytes).