RFC 9044 | Using AES-GMAC with the CMS | June 2021 |
Housley | Standards Track | [Page] |
This document specifies the conventions for using the AES-GMAC MessageAuthentication Code algorithm with the Cryptographic Message Syntax(CMS) as specified in RFC 5652.¶
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 athttps://www.rfc-editor.org/info/rfc9044.¶
Copyright (c) 2021 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://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.¶
This document specifies the conventions for using the AES-GMAC[AES][GCM] Message Authentication Code (MAC) algorithm with theCryptographic Message Syntax (CMS)[RFC5652].¶
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.¶
This section specifies the conventions employed by CMS[RFC5652]implementations that support the AES-GMAC[AES][GCM] MessageAuthentication Code (MAC) algorithm.¶
MAC algorithm identifiers are located in the AuthenticatedDatamacAlgorithm field.¶
MAC values are located in the AuthenticatedData mac field.¶
The AES-GMAC[AES][GCM] Message Authentication Code (MAC) algorithmuses one of the following algorithm identifiers in the AuthenticatedDatamacAlgorithm field; the choice depends on the size of the AES key, whichis either 128 bits, 192 bits, or 256 bits:¶
aes OBJECT IDENTIFIER ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) 1 } id-aes128-GMAC OBJECT IDENTIFIER ::= { aes 9 } id-aes192-GMAC OBJECT IDENTIFIER ::= { aes 29 } id-aes256-GMAC OBJECT IDENTIFIER ::= { aes 49 }¶
For all three of these algorithm identifier values, theAlgorithmIdentifier parameters fieldMUST be present, and the parametersMUST contain GMACParameters:¶
GMACParameters ::= SEQUENCE { nonce OCTET STRING, -- recommended size is 12 octets length MACLength DEFAULT 12 } MACLength ::= INTEGER (12 | 13 | 14 | 15 | 16)¶
The GMACParameters nonce field is the GMAC initializationvector. The nonce may have any number of bits between 8 and (2^64)-1,but itMUST be a multiple of 8 bits. Within the scope of anycontent-authentication key, the nonce valueMUST be unique. Anonce value of 12 octets can be processed more efficiently,so that length for the nonce value isRECOMMENDED.¶
The GMACParameters length field tells the size of the messageauthentication code. ItMUST match the size in octets of the valuein the AuthenticatedData mac field. A length of 12 octets isRECOMMENDED.¶
An implementation of the Advanced Encryption Standard (AES)Galois/Counter Mode (GCM) authenticated encryption algorithm is specifiedin[GCM]. An implementation of AES-GCM can be used to compute the GMACmessage authentication code by providing the content-authentication keyas the AES key, the nonce as the initialization vector, a zero-lengthplaintext content, and the content to be authenticated as the additionalauthenticated data (AAD). The result of the AES-GCM invocation is theAES-GMAC authentication code, which is called the "authentication tag" insome implementations. In AES-GCM, the encryption step is skipped when noinput plaintext is provided; therefore, no ciphertext is produced.¶
The DEFAULT andRECOMMENDED values in GMACParameters were selectedto align with the parameters defined for AES-GCM inSection 3.2 of [RFC5084].¶
The following ASN.1 module uses the definition for MAC-ALGORITHMfrom[RFC5912].¶
CryptographicMessageSyntaxGMACAlgorithms { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) modules(0) id-mod-aes-gmac-alg-2020(72) }DEFINITIONS IMPLICIT TAGS ::=BEGIN-- EXPORTS AllIMPORTS AlgorithmIdentifier{}, MAC-ALGORITHM FROM AlgorithmInformation-2009 -- from [RFC5912] { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-mod-algorithmInformation-02(58)} ;-- Object Identifiersaes OBJECT IDENTIFIER ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) 1 }id-aes128-GMAC OBJECT IDENTIFIER ::= { aes 9 }id-aes192-GMAC OBJECT IDENTIFIER ::= { aes 29 }id-aes256-GMAC OBJECT IDENTIFIER ::= { aes 49 }-- GMAC ParametersGMACParameters ::= SEQUENCE { nonce OCTET STRING, -- recommended size is 12 octets length MACLength DEFAULT 12 }MACLength ::= INTEGER (12 | 13 | 14 | 15 | 16)-- Algorithm Identifiersmaca-aes128-GMAC MAC-ALGORITHM ::= { IDENTIFIER id-aes128-GMAC PARAMS TYPE GMACParameters ARE required IS-KEYED-MAC TRUE }maca-aes192-GMAC MAC-ALGORITHM ::= { IDENTIFIER id-aes192-GMAC PARAMS TYPE GMACParameters ARE required IS-KEYED-MAC TRUE }maca-aes256-GMAC MAC-ALGORITHM ::= { IDENTIFIER id-aes256-GMAC PARAMS TYPE GMACParameters ARE required IS-KEYED-MAC TRUE }END -- of CryptographicMessageSyntaxGMACAlgorithms¶
IANA has registered the object identifier shown inTable 1 in the "SMI Security for S/MIME Module Identifier (1.2.840.113549.1.9.16.0)" registry.¶
Decimal | Description | References |
---|---|---|
72 | id-mod-aes-gmac-alg-2020 | RFC 9044 |
The CMS provides a method for authenticating data. This documentidentifies the conventions for using the AES-GMAC algorithm with the CMS.¶
The key management technique employed to distribute message-authenticationkeys must itself provide authentication; otherwise, the content is deliveredwith integrity from an unknown source.¶
When more than two parties share the same message-authentication key, dataorigin authentication is not provided. Any party that knows themessage-authentication key can compute a valid MAC; therefore, the contentcould originate from any one of the parties.¶
Within the scope of any content-authentication key, the AES-GMAC nonce valueMUST be unique. Use of a nonce value more than once allows an attacker togenerate valid AES-GMAC authentication codes for arbitrary messages, resultingin the loss of authentication as described in Appendix A of[GCM].¶
Within the scope of any content-authentication key, the authentication taglength (MACLength)MUST be fixed.¶
If AES-GMAC is used as a building block in another algorithm (e.g., asa pseudorandom function), AES-GMACMUST be used only one time by thatalgorithm. For instance, AES-GMACMUST NOT be used as the pseudorandomfunction for PBKDF2.¶
When initialization vector (IV) lengths other than 96 bits are used, the GHASH function is used toprocess the provided IV, which introduces a potential for IV collisions.However, IV collisions are not a concern with CMS AuthenticatedData becausea fresh content-authentication key is usually generated for each message.¶
The probability of a successful forgery is close to 2^(-t), where t is thenumber of bits in the authentication tag length (MACLength*8). This nearlyideal authentication protection is achieved for CMS AuthenticatedData when afresh content-authentication key is generated for each message. However, thestrength of GMAC degrades slightly as a function of the length of the messagebeing authenticated[F2005][MV2005]. ImplementationsSHOULD use 16-octetauthentication tags for messages over 2^64 octets.¶
Implementations must randomly generate message-authentication keys. The useof inadequate pseudorandom number generators (PRNGs) to generate keys canresult in little or no security. An attacker may find it much easier toreproduce the PRNG environment that produced the keys, searching the resultingsmall set of possibilities, rather than brute-force searching the whole keyspace. The generation of quality random numbers is difficult.[RFC4086]offers important guidance in this area.¶
Implementers should be aware that cryptographic algorithms become weakerwith time. As new cryptanalysis techniques are developed and computingperformance improves, the work factor to break a particular cryptographicalgorithm will reduce. Therefore, cryptographic algorithm implementationsshould be modular, allowing new algorithms to be readily inserted. That is,implementers should be prepared to regularly update the set of algorithmsin their implementations. More information is available in BCP 201[RFC7696].¶
Many thanks toHans Aschauer,Hendrik Brockhaus,Quynh Dang,Roman Danyliw,Tim Hollebeek,Ben Kaduk,Mike Ounsworth, andMagnus Westerlundfor their careful review and thoughtful improvements.¶