RFC 9688: Use of the SHA3 One-Way Hash Functions in the Cryptographic Message Syntax (CMS)
- R. Housley
Abstract
This document describes the conventions for using the one-way hash functions in the SHA3 family with the Cryptographic Message Syntax (CMS). The SHA3 family can be used as a message digest algorithm, as part of a signature algorithm, as part of a message authentication code, or as part of a Key Derivation Function (KDF).¶
Status of This Memo
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
https://
Copyright Notice
Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(https://
1. Introduction
The Cryptographic Message Syntax (CMS) [RFC5652] is used to digitally sign, digest, authenticate, or encrypt arbitrary message contents. This specification describes the use of the four one-way hash functions in the SHA3 family (SHA3-224, SHA3-256, SHA3-384, and SHA3-512) [SHA3] with the CMS. In addition, this specification describes the use of these four one-way hash functions with the RSASSA PKCS#1 version 1.5 signature algorithm [RFC8017] and the Elliptic Curve Digital Signature Algorithm (ECDSA) [DSS] with the CMS signed-data content type.¶
This document should not be confused with [RFC8702], which defines conventions for using the SHAKE family of SHA3-based extensible output functions with the CMS.¶
1.1. ASN.1
CMS values are generated with ASN.1 [X.680], using the Basic Encoding Rules (BER) and the Distinguished Encoding Rules (DER) [X.690].¶
1.2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
2. Message Digest Algorithms
One-way hash functions are also referred to as message digest algorithms. This section specifies the conventions employed by CMS implementations that support SHA3-224, SHA3-256, SHA3-384, and SHA3-512 [SHA3].¶
Digest algorithm identifiers are located in the SignedData digest
Digest values are located in the DigestedData digest field and the Message Digest authenticated attribute. In addition, digest values are input to signature algorithms.¶
SHA3-224, SHA3-256, SHA3-384, and SHA3-512 produce output values with 224, 256, 384, and 512 bits, respectively. The object identifiers for these four one-way hash functions are as follows:¶
When using the id-sha3-224, id-sha3-s256, id-sha3-384, or id-sha3-512 algorithm identifiers, the parameters field MUST be absent, not NULL but absent.¶
3. Signature Algorithms
This section specifies the conventions employed by CMS implementations that support the four SHA3 one-way hash functions with the RSASSA PKCS#1 v1.5 signature algorithm [RFC8017] and the ECDSA [DSS] with the CMS signed-data content type.¶
Signature algorithm identifiers are located in the SignerInfo
signature
Signature values are located in the SignerInfo signature field of
SignedData. Also, signature values are located in the SignerInfo
signature field of countersignatur
3.1. RSASSA PKCS#1 v1.5 with SHA3
The RSASSA PKCS#1 v1.5 is defined in [RFC8017]. When RSASSA PKCS#1 v1.5 is used in conjunction with one of the SHA3 one-way hash functions, the object identifiers are:¶
The algorithm identifier for RSASSA PKCS#1 v1.5 subject public keys in certificates is specified in [RFC3279], and it is repeated here for convenience:¶
When the rsaEncryption, id
When the rsaEncryption algorithm identifier is used, the RSA public key, which is composed of a modulus and a public exponent, MUST be encoded using the RSAPublicKey type as specified in [RFC3279]. The output of this encoding is carried in the certificate subject public key. The definition of RSAPublicKey is repeated here for convenience:¶
When signing, the RSASSA PKCS#1 v1.5 signature algorithm generates a single value. That value is used directly as the signature value.¶
3.2. ECDSA with SHA3
The ECDSA is defined in [DSS]. When the ECDSA is used in conjunction with one of the SHA3 one-way hash functions, the object identifiers are:¶
When the id-sha3-224, id-sha3-s256, id-sha3-384, or id-sha3-512 algorithm identifier is used, the parameters field MUST be absent, not NULL but absent.¶
When the id
The conventions for ECDSA public keys are as specified in [RFC5480]. The ECParameters associated with the ECDSA public key in the signers certificate SHALL apply to the verification of the signature.¶
When signing, the ECDSA algorithm generates two values. These values are commonly referred to as r and s. To easily transfer these two values as one signature, they MUST be ASN.1 encoded using the ECDSA-Sig-Value defined in [RFC3279], which is repeated here for convenience:¶
4. Message Authentication Codes Using HMAC and SHA3
This section specifies the conventions employed by CMS implementations that support the Hashed Message Authentication Code (HMAC) [RFC2104] with SHA3 message authentication code (MAC).¶
MAC algorithm identifiers are located in the Authenticated
MAC values are located in the Authenticated
When HMAC is used in conjunction with one of the SHA3 one-way hash functions, the object identifiers are:¶
When the id
5. Key Derivation Functions
The CMS KEMRecipient
5.1. HKDF with SHA3
This section assigns four algorithm identifiers that can be employed by CMS
implementations that support the HMAC-based Extract
When HKDF is used in conjunction with one of the SHA3 one-way hash functions, the object identifiers are:¶
When id
5.2. KMAC128-KDF and KMAC256-KDF
This section specifies the conventions employed by CMS implementations
that employ either KMAC128 or KMAC256 as KDFs as
defined in Section 4.4 of [NIST
KMAC128 and KMAC256 are specified in [NIST.SP.800-185]. The use of KMAC128 and KMAC256 as KDFs are defined as follows:¶
KMAC128-KDF is KMAC128(K, X, L, S).¶
KMAC256-KDF is KMAC256(K, X, L, S).¶
The parameters to the KMAC128 and KMAC256 functions are:¶
- K
-
The input key-derivation key. The length of K MUST be less than 22040.¶
- X
-
The context, which contains the ASN.1 DER encoding of CMSORIfor
KEMOther Info when the KDF is used with [RFC9629].¶ - L
-
The output length in bits. L MUST be greater than or equal to 0 and MUST be less than 22040.¶
- S
-
The optional customization label, such as "KDF" (0x4B4446). The length of S MUST be less than 22040.¶
The K parameter is known to all authorized parties; it is often the output of a KEM Decap() operation. The X parameter is assembled from data that is transmitted by the originator. The L parameter is determined by the size of the output keying material. The S parameter is optional, and if it is provided by the originator, it is passed in the parameters field of the KDF algorithm identifier.¶
When KMAC128-KDF or KMAC256-KDF is used, the object identifiers are:¶
When id-kmac128 or id-kmac256 is used as part of an algorithm identifier, the parameters field MUST be absent when there is no customization label (S). If any value is provided for S, then the parameters field MUST be present and contain the value of S, encoded as Customization.¶
5.3. KDF2 and KDF3 with SHA3
This section specifies the conventions employed by CMS implementations
that employ either the KDF2 or KDF3 functions defined in [ANS-X9.44-2007].
The CMS KEMRecipient
The key-derivation function algorithm identifier is an object identifier and optional parameters. When KDF2 and KDF3 are used, they are identified by the id-kdf-kdf2 and id-kdf-kdf3 object identifiers, respectively. The key-derivation function algorithm identifier parameters carry a message digest algorithm identifier, which indicates the hash function that is being employed. To support SHA3, the key-derivation function algorithm identifier parameters contain an algorithm identifier from Section 2.¶
6. Security Considerations
Implementations must protect the signer's private key. Compromise of the signer's private key permits masquerade.¶
Implementations must protect the key-derivation key. Compromise of the
key-derivation key permits others to derive the derived keying material,
which would result in loss of confidentiality
When more than two parties share the same message
Implementations must randomly generate message
Implementers should be aware that cryptographic algorithms become weaker
with time. As new cryptanalysis techniques are developed and computing
performance improves, the work factor to break a particular cryptographic
algorithm will reduce. Therefore, cryptographic algorithm
implementations should be modular, allowing new algorithms to be readily
inserted. That is, implementers should be prepared to regularly update
the set of algorithms in their implementations
7. IANA Considerations
IANA has assigned one object identifier for the ASN.1 module in Appendix A
in the "SMI Security for S/MIME Module Identifiers
IANA has assigned four object identifiers for the HKDF using SHA3 algorithm
identifiers in the "SMI Security for S/MIME Algorithms
8. References
8.1. Normative References
- [ANS-X9.44-2007]
-
American National Standards Institute, "Public Key Cryptography for the Financial Services Industry -- Key Establishment Using Integer Factorization Cryptography", ANSI X9.44-2007 (R2017), , <https://
webstore >..ansi .org /standards /ascx9 /ansix9442007r20 17 - [DSS]
-
National Institute of Standards and Technology, "Digital Signature Standard (DSS)", FIPS PUB 186-5, DOI 10
.6028 , , <https:///NIST .FIPS .186 -5 nvlpubs >..nist .gov /nistpubs /FIPS /NIST .FIPS .186 -5 .pdf - [NIST
.SP .800 -108r1 -upd1] -
Chen, L., "Recommendation for Key Derivation Using Pseudorandom Functions", NIST SP 800-108r1-upd1, DOI 10
.6028 , , <https:///NIST .SP .800 -108r1 -upd1 nvlpubs >..nist .gov /nistpubs /Special Publications /NIST .SP .800 -108r1 -upd1 .pdf - [NIST
.SP .800 -185] -
Kelsey, J., Chang, S., and R. Perlner, "SHA-3 Derived Functions: cSHAKE, KMAC, TupleHash and ParallelHash", NIST SP 800-185, DOI 10
.6028 , , <https:///NIST .SP .800 -185 nvlpubs >..nist .gov /nistpubs /Special Publications /NIST .SP .800 -185 .pdf - [RFC2104]
-
Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed-Hashing for Message Authentication", RFC 2104, DOI 10
.17487 , , <https:///RFC2104 www >..rfc -editor .org /info /rfc2104 - [RFC2119]
-
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10
.17487 , , <https:///RFC2119 www >..rfc -editor .org /info /rfc2119 - [RFC3279]
-
Bassham, L., Polk, W., and R. Housley, "Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 3279, DOI 10
.17487 , , <https:///RFC3279 www >..rfc -editor .org /info /rfc3279 - [RFC5480]
-
Turner, S., Brown, D., Yiu, K., Housley, R., and T. Polk, "Elliptic Curve Cryptography Subject Public Key Information", RFC 5480, DOI 10
.17487 , , <https:///RFC5480 www >..rfc -editor .org /info /rfc5480 - [RFC5652]
-
Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, RFC 5652, DOI 10
.17487 , , <https:///RFC5652 www >..rfc -editor .org /info /rfc5652 - [RFC5869]
-
Krawczyk, H. and P. Eronen, "HMAC-based Extract
-and , RFC 5869, DOI 10-Expand Key Derivation Function (HKDF)" .17487 , , <https:///RFC5869 www >..rfc -editor .org /info /rfc5869 - [RFC5912]
-
Hoffman, P. and J. Schaad, "New ASN.1 Modules for the Public Key Infrastructure Using X.509 (PKIX)", RFC 5912, DOI 10
.17487 , , <https:///RFC5912 www >..rfc -editor .org /info /rfc5912 - [RFC8017]
-
Moriarty, K., Ed., Kaliski, B., Jonsson, J., and A. Rusch, "PKCS #1: RSA Cryptography Specifications Version 2.2", RFC 8017, DOI 10
.17487 , , <https:///RFC8017 www >..rfc -editor .org /info /rfc8017 - [RFC8174]
-
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10
.17487 , , <https:///RFC8174 www >..rfc -editor .org /info /rfc8174 - [SHA3]
-
National Institute of Standards and Technology, "SHA-3 Standard: Permutation
-Based Hash and Extendable , NIST FIPS 202, DOI 10-Output Functions" .6028 , , <http:///NIST .FIPS .202 nvlpubs >..nist .gov /nistpubs /FIPS /NIST .FIPS .202 .pdf - [X.680]
-
ITU-T, "Information technology - Abstract Syntax Notation One (ASN.1): Specification of basic notation", ITU-T Recommendation X.680, ISO/IEC 8824-1:2021, , <https://
www >..itu .int /rec /T -REC -X .680 -202102 -I /en - [X.690]
-
ITU-T, "Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)", ITU-T Recommendation X.690, ISO/IEC 8825-1:2021, , <https://
www >..itu .int /rec /T -REC -X .690 -202102 -I /en
8.2. Informative References
- [IANA-ALG]
-
IANA, "SMI Security for S/MIME Algorithms
(1 , <https://.2 .840 .113549 .1 .9 .16 .3 )" www >..iana .org /assignments /smi -numbers / - [IANA-MOD]
-
IANA, "SMI Security for S/MIME Module Identifier
(1 , <https://.2 .840 .113549 .1 .9 .16 .0 )" www >..iana .org /assignments /smi -numbers / - [RFC4086]
-
Eastlake 3rd, D., Schiller, J., and S. Crocker, "Randomness Requirements for Security", BCP 106, RFC 4086, DOI 10
.17487 , , <https:///RFC4086 www >..rfc -editor .org /info /rfc4086 - [RFC8702]
-
Kampanakis, P. and Q. Dang, "Use of the SHAKE One-Way Hash Functions in the Cryptographic Message Syntax (CMS)", RFC 8702, DOI 10
.17487 , , <https:///RFC8702 www >..rfc -editor .org /info /rfc8702 - [RFC9629]
-
Housley, R., Gray, J., and T. Okubo, "Using Key Encapsulation Mechanism (KEM) Algorithms in the Cryptographic Message Syntax (CMS)", RFC 9629, DOI 10
.17487 , , <https:///RFC9629 www >..rfc -editor .org /info /rfc9629
Appendix A. ASN.1 Module
This section contains the ASN.1 module for the algorithm identifiers using the SHA3 family of hash functions [SHA3]. This module imports types from other ASN.1 modules that are defined in [RFC5912].¶
Acknowledgements
Thanks to Daniel Van Geest and Sean Turner for their careful review and thoughtful comments.¶
Thanks to Sara Kerman, Quynh Dang, and David Cooper for getting the object identifiers assigned for KMAC128 and KMAC256.¶