The short version

  • RFC 3537, published in May 2003, put a single length octet in front of an HMAC key, then padded the record to the block boundary its 3DES or AES wrapping path demanded.
  • A clean unwrap returns the intended bytes. It does not name the digest that will consume them, the service allowed to use them, or the authority that put them there.

Picture a mail gateway opening a CMS AuthenticatedData package. One key is wrapped for one recipient. The recipient’s system unwraps it, recovers an exact run of bytes, and keeps going. The envelope did its job. But that green checkmark answers a far smaller question than it looks like it does: did this representation survive the key-wrap integrity check? It does not say which hash function should eat the bytes, whether this service is permitted to use them, whose authority placed them there, or whether the package is still current.

That gap is RFC 3537’s real contribution to the record. Published in May 2003 as a Standards Track Proposed Standard out of the S/MIME working group, it adapted the established 3DES and AES wrapping methods for HMAC keys whose lengths and parity quirks did not fit the inherited constructions. It named CMS AuthenticatedData as one application. It built a key-transport mechanism — not an authorization format, and not a provenance format.

A byte count, then the bytes

Every construction starts LENGTH || KEY. LENGTH is one octet, and that many octets of key material follow. The wrapper then adds the fewest random padding octets needed to land on a multiple of eight bytes. So “arbitrary length” in the introduction means the key no longer has to match the older wrap algorithms’ fixed sizes — not that the length field is unbounded. The RFC never dresses this up as an application policy on maximum key size.

The pad is not a margin note. It lives inside the wrapped representation and is covered by the integrity construction. On unwrap, the receiver checks the encoded object’s integrity, splits length, key and remainder, and rejects any pad longer than seven octets. That is enough to recover a byte string without guessing where the key stops. It is not enough to say “HMAC-SHA-256, for this tenant’s audit trail, valid until the next rotation.” Random padding carries no label.

Two inherited protection paths

RFC 3537 does not invent one tidy cipher transform. The 3DES branch follows RFC 3217’s wrapping construction, tolerates a key with no 3DES parity requirements, carries an eight-octet checksum, and uses a random initialization vector ahead of the outer fixed-IV step. The AES branch reuses RFC 3394’s key wrap and prepends the length-and-padding record before wrapping. The AES integrity value and the 3DES checksum are not interchangeable trivia; each is read through its own construction.

Which is why RFC 3394 remains a separate story. RFC 3394 owns the A value stirred through the transform and verified before any candidate plaintext escapes. RFC 3537 owns the envelope around it: how a variable-length key gets framed so it can be wrapped and recovered at all. RFC 3058 stays separate too, covering IDEA wrapping with its own capability and checksum questions. RFC 3217 is context for the 3DES branch, not the thesis.

The algorithm identifiers draw another boundary. RFC 3537 assigns OIDs to HMAC-key wrapping with 3DES and with AES, and requires NULL parameters. Those names tell a CMS-aware consumer which wrapping operation it is looking at. They are not the identity of the HMAC digest that later consumes the recovered key. RFC 2104 governs the key’s life as HMAC input; RFC 3537 governs the envelope. Confusing the two collapses two protocol layers into one comfortable assumption.

Integrity can be true while origin is unknown

The security section says the KEK must be protected, and warns that a compromised KEK may expose every HMAC key wrapped under it. Then it states the subtler limit: the wrap functions provide confidentiality and data integrity, but do not necessarily provide data-origin authentication. Anyone holding the KEK can manufacture a message that passes the integrity check. If origin authentication is required, the KEK-distribution mechanism must authenticate its origin — or a digital signature must supply that evidence.

This is not a charge that the algorithms fail their stated checks. It is a statement about what those checks attest. A system that reads “unwrap succeeded” as “the intended authority approved this key for this operation” has handed a receipt a job the receipt never applied for. The cryptographic object can be perfectly well formed and perfectly intact while its source, purpose and authorization remain unproven.

A correction to the record, not the algorithm

RFC Editor Verified Erratum 254 fixes one value in the 3DES test vector: the PAD line should read be62fe, not 38be62. The corrected value agrees with the bytes shown in the following LKEYPADICV line. That is an editorial repair to a published vector — not a change to the wrap procedure, and not evidence of a deployed cryptographic failure.

Why the distinction still earns its keep

The lesson is architectural rather than algorithmic. A system may genuinely need a recoverable key, but it also needs separately authenticated evidence for the digest, the intended operation, the principal, the origin and the validity period. A signed manifest or a protocol-specific authenticated context can carry those decisions. The key-wrap envelope should not be credited with fields it never encoded.

RFC 3537 drew a useful transport boundary and drew it cleanly. Systems stay auditable when they keep that boundary where the RFC left it — because the envelope was never the authority. It was the postmark.

Sources