Elliptic Curve Diffie-Hellman (ECDH) is the CNSA Suite key agreement algorithm. Since S/MIME is used in store-and-forward communications, ephemeral-static ECDH is always employed. This means that the message originator possesses an ephemeral ECDH key pair and that the message recipient possesses a static ECDH key pair whose public key is provided in an X.509 certificate. The certificate used to obtain the recipient's public key
MUST be compliant with [
RFC 8603].
When a key agreement algorithm is used, the following steps are performed:
-
A content-encryption key (CEK) for a particular content-encryption algorithm is generated at random.
-
The recipient's public key and sender's private key are used with a key agreement scheme to generate a shared secret (Z).
-
The shared secret is used with a key derivation function (KDF) to produce a key-encryption key (KEK).
-
The KEK is used with a key wrap algorithm to encrypt the CEK.
Key derivation is discussed in
Section 6.1.1. Key wrapping is discussed in
Section 6.1.2.
Section 3.1 of
RFC 5753 specifies the conventions for using ECDH with the CMS. CNSA Suite-compliant S/MIME implementations
MUST follow these conventions.
Within the CMS enveloped-data and authenticated-enveloped-data content types, key agreement algorithm identifiers are located in the EnvelopedData RecipientInfos KeyAgreeRecipientInfo keyEncryptionAlgorithm field.
The keyEncryptionAlgorithm field comprises two fields, an algorithm field and a parameter field. The algorithm field
MUST identify dhSinglePass-stdDH-sha384kdf-scheme. The algorithm identifier for the dhSinglePass-stdDH-sha384kdf-scheme, repeated from
Section 7.1.4 of
RFC 5753, is (presented here in expanded form):
dhSinglePass-stdDH-sha384kdf-scheme OBJECT IDENTIFIER ::=
{ iso(1) identified-organization(3) certicom(132)
schemes(1) 11 2 }
The keyEncryptionAlgorithm parameter field
MUST be constructed as described in
Section 6.1.2.
KDFs based on SHA-384 are used to derive a pairwise key-encryption key from the shared secret produced by ephemeral-static ECDH. Sections
7.1.8 and
7.2 in [
RFC 5753] specify the CMS conventions for using a KDF with the shared secret generated during ephemeral-static ECDH. CNSA Suite-compliant S/MIME implementations
MUST follow these conventions.
As specified in
Section 7.1.8 of
RFC 5753, the ANSI-X9.63-KDF described in Section 3.6.1 of [
SEC1] and based on SHA-384
MUST be used.
As specified in
Section 7.2 of
RFC 5753, when using ECDH with the CMS enveloped-data or authenticated-enveloped-data content type, the derivation of key-encryption keys makes use of the ECC-CMS-SharedInfo type:
ECC-CMS-SharedInfo ::= SEQUENCE {
keyInfo AlgorithmIdentifier,
entityUInfo [0] EXPLICIT OCTET STRING OPTIONAL,
suppPubInfo [2] EXPLICIT OCTET STRING }
In the CNSA Suite for S/MIME, the fields of ECC-CMS-SharedInfo are used as follows:
-
keyInfo contains the object identifier of the key-encryption algorithm used to wrap the content-encryption key. If AES-256 Key Wrap is used, then the keyInfo will contain id-aes256-wrap-pad, and the parameters will be absent.
-
entityUInfo optionally contains a random value provided by the message originator. If user keying material (ukm) is included in the KeyAgreeRecipientInfo, then the entityUInfo MUST be present, and it MUST contain the ukm value. If the ukm is not present, then the entityUInfo MUST be absent.
-
suppPubInfo contains the length of the generated key-encryption key in bits, represented as a 32-bit unsigned number, as described in [RFC 2631]. When a 256-bit AES key is used, the length MUST be 0x00000100.
ECC-CMS-SharedInfo is DER encoded and is used as input to the key derivation function, as specified in Section 3.6.1 of [
SEC1]. Note that ECC-CMS-SharedInfo differs from the OtherInfo specified in [
RFC 2631]. Here, a counter value is not included in the keyInfo field because the KDF specified in [
SEC1] ensures that sufficient keying data is provided.
The KDF specified in Section 3.6.1 of [
SEC1] describes how to generate an essentially arbitrary amount of keying material from a shared secret, Z, produced by ephemeral-static ECDH. To generate an L-bit key-encryption key (KEK), blocks of key material (KM) are computed by incrementing Counter appropriately until enough material has been generated:
KM(Counter) = Hash ( Z || Counter || ECC-CMS-SharedInfo )
The KM blocks are concatenated left to right as they are generated, and the first (leftmost) L bits are used as the KEK:
KEK = the leftmost L bits of
[KM ( counter=1 ) || KM ( counter=2 ) ...]
In the CNSA Suite for S/MIME, the elements of the KDF are defined as follows:
-
Hash is a one-way hash function. The SHA-384 hash MUST be used.
-
Z is the shared secret value generated during ephemeral-static ECDH. Z MUST be exactly 384 bits, i.e., leading zero bits MUST be preserved.
-
Counter is a 32-bit unsigned number represented in network byte order. Its initial value MUST be 0x00000001 for any key derivation operation.
-
ECC-CMS-SharedInfo is composed as described above. It MUST be DER encoded.
In the CNSA Suite for S/MIME, exactly one iteration is needed; the Counter is not incremented. The key-encryption key (KEK)
MUST be the first (leftmost) 256 bits of the SHA-384 output value:
KEK = the leftmost 256 bits of
SHA-384 ( Z || 0x00000001 || ECC-CMS-SharedInfo )
Note that the only source of secret entropy in this computation is Z.
The AES Key Wrap with Padding key-encryption algorithm, as specified in [
RFC 5649] and [
SP80038F], is used to encrypt the content-encryption key with a pairwise key-encryption key that is generated using ephemeral-static ECDH.
Section 8 of
RFC 5753 specifies the CMS conventions for using AES Key Wrap with a pairwise key generated through ephemeral-static ECDH. CNSA Suite-compliant S/MIME implementations
MUST follow these conventions.
Within the CMS enveloped-data content type, key wrap algorithm identifiers are located in the KeyWrapAlgorithm parameters within the EnvelopedData RecipientInfos KeyAgreeRecipientInfo keyEncryptionAlgorithm field.
The KeyWrapAlgorithm
MUST be id-aes256-wrap-pad. The required algorithm identifier, specified in [
RFC 5649], is:
id-aes256-wrap-pad OBJECT IDENTIFIER ::= { joint-iso-itu-t(2)
country(16) us(840) organization(1) gov(101) csor(3)
nistAlgorithm(4) aes(1) 48 }
RSA encryption (RSA) is the CNSA Suite key transport algorithm. The RSA key transport algorithm is the RSA encryption scheme defined in [
RFC 8017], where the message to be encrypted is the content-encryption key.
The recipient of an S/MIME message possesses an RSA key pair whose public key is represented by an X.509 certificate. The certificate used to obtain the recipient's public key
MUST be compliant with [
RFC 8603]. These certificates are suitable for use with either RSAES-OAEP or RSAES-PKCS1-v1_5.
Section 4.2 of
RFC 3370 specifies the conventions for using RSAES-PKCS1-v1_5 with the CMS. S/MIME implementations employing this form of key transport
MUST follow these conventions.
Within the CMS enveloped-data and authenticated-enveloped-data content types, key transport algorithm identifiers are located in the EnvelopedData RecipientInfos KeyTransRecipientInfo keyEncryptionAlgorithm field.
The algorithm identifier for RSA (PKCS #1 v1.5) is:
rsaEncryption OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 1 }
The AlgorithmIdentifier parameters field
MUST be present, and the parameters field
MUST contain NULL.
[
RFC 3560] specifies the conventions for using RSAES-OAEP with the CMS. CNSA Suite-compliant S/MIME implementations employing this form of key transport
MUST follow these conventions.
Within the CMS enveloped-data and authenticated-enveloped-data content types, key transport algorithm identifiers are located in the EnvelopedData RecipientInfos KeyTransRecipientInfo keyEncryptionAlgorithm field.
The algorithm identifier for RSA (OAEP) is:
id-RSAES-OAEP OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 7 }
The parameters field of an AlgorithmIdentifier that identifies RSAES-OAEP is defined in [
RFC 4055] as follows:
RSAES-OAEP-params ::= SEQUENCE {
hashFunc [0] AlgorithmIdentifier DEFAULT
sha1Identifier,
maskGenFunc [1] AlgorithmIdentifier DEFAULT
mgf1SHA1Identifier,
pSourceFunc [2] AlgorithmIdentifier DEFAULT
pSpecifiedEmptyIdentifier }
pSpecifiedEmptyIdentifier AlgorithmIdentifier ::=
{ id-pSpecified, nullOctetString }
nullOctetString OCTET STRING (SIZE (0)) ::= { ''H }
The AlgorithmIdentifier parameters field
MUST be present, and the parameters field
MUST contain RSAES-OAEP-params with values as follows:
-
The hashFunc algorithm must be id-sha384 as defined in [RFC 8017];
-
The mask generation function must use the algorithm identifier mfg1SHA384Identifier as defined in [RFC 4055];
-
The pSourceFunc field must be absent.
The SMIMECapabilities signed attribute is used to specify a partial list of algorithms that the software announcing the SMIMECapabilities can support. If the SMIMECapabilities signed attribute is included to announce support for the RSAES-OAEP algorithm, it
MUST be constructed as defined in
Section 5 of
RFC 3560, with the sequence representing the rSAES-OAEP-SHA384-Identifier.