rfc-3211

Password-based Encryption for CMS

P. Gutmann
date2001-12 streamIETF areasec wgsmime statusPROPOSED STANDARD pages17 canonicalhttps://www.rfc-editor.org/rfc/rfc3211 doi10.17487/RFC3211
This document provides a method of encrypting data using user-supplied passwords and, by extension, any form of variable-length keying material which is not necessarily an algorithm-specific fixed-format key. The Cryptographic Message Syntax data format does not currently contain any provisions for password-based data encryption. [STANDARDS-TRACK]

obsoleted by

Extracted elements (23)

design-rationale §2.2.1

A level of indirection is used in KeyEncryptionAlgorithmIdentifier so that alternative wrapping algorithms can be introduced without requiring structural changes to PasswordRecipientInfo. If the KEK algorithm were specified directly, any alternative would require a new structure.

crypto, security

design-rationale §2.3.4

Double wrapping is used to eliminate block collision attacks: with a 64-bit block cipher, after ~2^32 encryptions collisions between encrypted CEK blocks could allow an attacker who recovers one CEK to derive others. Double encryption makes every ciphertext bit depend on every plaintext bit.

crypto, security

design-rationale §2.3.4

Double wrapping requires no additional algorithm (e.g., no hash function), allowing implementation on constrained devices such as smart cards that typically support only a single block cipher and a single public-key algorithm.

crypto, security

design-rationale §1.2.2

No mechanism is provided to differentiate between multiple PasswordRecipientInfos for the same data (e.g., two passwords for one file), as there is insufficient existing practice to define such a mechanism; a future version may add an optional identification field.

crypto, security

design-rationale §2.3.1

PKCS #5 padding is not used when formatting the CEK block because the length of the data is already encoded explicitly in the length byte; padding is random and serves only to reach the required block-multiple length.

crypto, security

design-rationale §1.2.2

The two-stage design (password→KEK, KEK→CEK) is specified separately rather than wrapped into a single algorithm identifier as in PKCS #5v2, because the combined design is particular to that standard and may not apply to other key wrapping mechanisms.

crypto, security

interoperability-note §Appendix A

Implementations may encounter PBKDF2 encoded with an alternative HMAC-SHA1 OID from the IPsec arc (1.3.6.1.5.5.8.1.2) with absent rather than NULL parameters, due to the inability to precisely specify PBKDF2 in 1988 ASN.1.

crypto, security

interoperability-note §2.2

There is no requirement that the CEK algorithm match the KEK encryption algorithm, but care should be taken to ensure equivalent security levels; wrapping a Triple-DES key with an RC2/40 key results in a severe impedance mismatch in encryption strength.

crypto, security

normative-requirement §2.3.2 MUST

After unwrapping, the CEK byte count must be within the valid range for the CEK algorithm and not exceed the wrapped key length; the bitwise complement of the check value must match the first three bytes of the CEK. Failure indicates an invalid KEK.

crypto, security

normative-requirement §2.2 MUST

Conforming implementations MUST implement the id-alg-PWRI-KEK key wrap algorithm, and MUST include Triple-DES in CBC mode as a KEK encryption algorithm.

crypto, security

normative-requirement §2.1 MUST

Conforming implementations MUST include PBKDF2 (RFC 2898) as a supported key derivation algorithm.

crypto, security

normative-requirement §2.2 SHOULD NOT

Implementations SHOULD NOT include keystream generator (KSG) ciphers such as RC4, or a block cipher in OFB mode, as KEK encryption algorithms. Block ciphers in ECB mode SHOULD NOT be included.

crypto, security

normative-requirement §1.2.1 MUST

The version field of PasswordRecipientInfo MUST be set to 0.

crypto, security

protocol-element §2.3.2

Key unwrapping reverses the double encryption: (1) decrypt the nth ciphertext block using the (n-1)th block as IV, (2) decrypt blocks 1..n-1 using the decrypted nth block as IV, (3) decrypt the inner layer with the KEK and original IV.

crypto, security

protocol-element §2.3.1

Key wrapping is a two-pass process: (1) encrypt the formatted CEK block with the KEK using the specified IV, then (2) without resetting the IV (using the last ciphertext block as the IV), encrypt the result a second time. The output is the EncryptedKey.

crypto, security

protocol-element §1.2

PasswordRecipientInfo (pwri [3]) is added as a fourth CHOICE in RecipientInfo, alongside KeyTransRecipientInfo, KeyAgreeRecipientInfo, and KEKRecipientInfo. It provides password-based key wrapping for CMS.

crypto, security

protocol-element §2.2

The id-alg-PWRI-KEK algorithm identifier (OID 1.2.840.113549.1.9.16.3.9) identifies the key wrap algorithm. Its AlgorithmIdentifier parameters field specifies the underlying KEK encryption algorithm used within the wrap.

crypto, registry, security

registry §5

The id-alg-PWRI-KEK OID (1.2.840.113549.1.9.16.3.9) is assigned from the S/MIME Working Group arc contributed by RSA Security. No IANA action is required; additional algorithm OIDs are expected to come from advocates' own arcs.

registry, crypto, security

security-consideration §4 RECOMMENDED

The security of PasswordRecipientInfo when used with a password rests critically on the entropy of the user-selected password, which is typically low. Pass phrases are STRONGLY RECOMMENDED, though even pass phrases may be insufficient to protect 128-bit or higher CEKs.

crypto, security, privacy

security-consideration §4

The security of this recipient information type also rests on the security of the underlying mechanisms (RFC 2630 and PKCS5v2). The double-wrap prevents bit-flipping attacks and ensures that wrapping the same CEK with the same KEK produces a different EncryptedKey each time due to the IV.

crypto, security

wire-format §1.2.1

PasswordRecipientInfo is a SEQUENCE containing: version (CMSVersion, always 0), keyDerivationAlgorithm ([0] OPTIONAL AlgorithmIdentifier), keyEncryptionAlgorithm (AlgorithmIdentifier), and encryptedKey (OCTET STRING).

crypto, security

wire-format §Appendix A

PBKDF2-params is a SEQUENCE of: salt (OCTET STRING), iterationCount (INTEGER 1..MAX), optional keyLength (INTEGER 1..MAX), and prf (AlgorithmIdentifier, defaulting to id-hmacWithSHA1 with NULL parameters).

crypto, security

wire-format §2.3.1

The formatted CEK block consists of: (1) a one-byte count of CEK bytes, (2) a three-byte check value (bitwise complement of first three CEK bytes), (3) the CEK itself, and (4) random padding to make the block a multiple of the KEK block length and at least two KEK cipher blocks long.

crypto, security