Using the AES-GMAC Algorithm with the Cryptographic Message Syntax (CMS)Vigil Security, LLC516 Dranesville RoadHerndonVA20170United States of Americahousley@vigilsec.com
Security
AuthenticationMessage Authentication CodeThis document specifies the conventions for using the AES-GMAC Message
Authentication Code algorithm with the Cryptographic Message Syntax
(CMS) as specified in RFC 5652.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
.
Copyright Notice
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
() 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.
Table of Contents
. Introduction
. Terminology
. Message Authentication Code Algorithms
. AES-GMAC
. Implementation Considerations
. ASN.1 Module
. IANA Considerations
. Security Considerations
. References
. Normative References
. Informative References
Acknowledgements
Author's Address
IntroductionThis document specifies the conventions for using the AES-GMAC
Message Authentication Code (MAC) algorithm with the
Cryptographic Message Syntax (CMS) .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
when, and only when, they appear in all capitals, as shown here.
Message Authentication Code AlgorithmsThis section specifies the conventions employed by CMS
implementations that support the AES-GMAC Message
Authentication Code (MAC) algorithm.MAC algorithm identifiers are located in the AuthenticatedData
macAlgorithm field.MAC values are located in the AuthenticatedData mac field.AES-GMACThe AES-GMAC Message Authentication Code (MAC) algorithm
uses one of the following algorithm identifiers in the AuthenticatedData
macAlgorithm field; the choice depends on the size of the AES key, which
is 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, the
AlgorithmIdentifier parameters field MUST be present, and the parameters
MUST 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 initialization
vector. The nonce may have any number of bits between 8 and (2^64)-1,
but it MUST be a multiple of 8 bits. Within the scope of any
content-authentication key, the nonce value MUST be unique. A
nonce value of 12 octets can be processed more efficiently,
so that length for the nonce value is RECOMMENDED.The GMACParameters length field tells the size of the message
authentication code. It MUST match the size in octets of the value
in the AuthenticatedData mac field. A length of 12 octets is
RECOMMENDED.Implementation ConsiderationsAn implementation of the Advanced Encryption Standard (AES)
Galois/Counter Mode (GCM) authenticated encryption algorithm is specified
in . An implementation of AES-GCM can be used to compute the GMAC
message authentication code by providing the content-authentication key
as the AES key, the nonce as the initialization vector, a zero-length
plaintext content, and the content to be authenticated as the additional
authenticated data (AAD). The result of the AES-GCM invocation is the
AES-GMAC authentication code, which is called the "authentication tag" in
some implementations. In AES-GCM, the encryption step is skipped when no
input plaintext is provided; therefore, no ciphertext is produced.The DEFAULT and RECOMMENDED values in GMACParameters were selected
to align with the parameters defined for AES-GCM in .ASN.1 ModuleThe following ASN.1 module uses the definition for MAC-ALGORITHM
from .
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 All
IMPORTS
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 Identifiers
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 }
-- GMAC Parameters
GMACParameters ::= SEQUENCE {
nonce OCTET STRING, -- recommended size is 12 octets
length MACLength DEFAULT 12 }
MACLength ::= INTEGER (12 | 13 | 14 | 15 | 16)
-- Algorithm Identifiers
maca-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 Considerations
IANA has registered the object identifier shown in 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
Security ConsiderationsThe CMS provides a method for authenticating data. This document
identifies the conventions for using the AES-GMAC algorithm with the CMS.The key management technique employed to distribute message-authentication
keys must itself provide authentication; otherwise, the content is delivered
with integrity from an unknown source.When more than two parties share the same message-authentication key, data
origin authentication is not provided. Any party that knows the
message-authentication key can compute a valid MAC; therefore, the content
could originate from any one of the parties.Within the scope of any content-authentication key, the AES-GMAC nonce value
MUST be unique. Use of a nonce value more than once allows an attacker to
generate valid AES-GMAC authentication codes for arbitrary messages, resulting
in the loss of authentication as described in Appendix A of .Within the scope of any content-authentication key, the authentication tag
length (MACLength) MUST be fixed.If AES-GMAC is used as a building block in another algorithm (e.g., as
a pseudorandom function), AES-GMAC MUST be used only one time by that
algorithm. For instance, AES-GMAC MUST NOT be used as the pseudorandom
function for PBKDF2.When initialization vector (IV) lengths other than 96 bits are used, the GHASH function is used to
process the provided IV, which introduces a potential for IV collisions.
However, IV collisions are not a concern with CMS AuthenticatedData because
a fresh content-authentication key is usually generated for each message.The probability of a successful forgery is close to 2^(-t), where t is the
number of bits in the authentication tag length (MACLength*8). This nearly
ideal authentication protection is achieved for CMS AuthenticatedData when a
fresh content-authentication key is generated for each message. However, the
strength of GMAC degrades slightly as a function of the length of the message
being authenticated . Implementations SHOULD use 16-octet
authentication tags for messages over 2^64 octets.Implementations must randomly generate message-authentication keys. The use
of inadequate pseudorandom number generators (PRNGs) to generate keys can
result in little or no security. An attacker may find it much easier to
reproduce the PRNG environment that produced the keys, searching the resulting
small set of possibilities, rather than brute-force searching the whole key
space. The generation of quality random numbers is difficult.
offers important guidance in this area.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. More information is available in BCP 201 .ReferencesNormative ReferencesAdvanced Encryption Standard (AES)National Institute of Standards and TechnologyRecommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMACKey words for use in RFCs to Indicate Requirement LevelsIn many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.Cryptographic Message Syntax (CMS)This document describes the Cryptographic Message Syntax (CMS). This syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary message content. [STANDARDS-TRACK]New ASN.1 Modules for the Public Key Infrastructure Using X.509 (PKIX)The Public Key Infrastructure using X.509 (PKIX) certificate format, and many associated formats, are expressed using ASN.1. The current ASN.1 modules conform to the 1988 version of ASN.1. This document updates those ASN.1 modules to conform to the 2002 version of ASN.1. There are no bits-on-the-wire changes to any of the formats; this is simply a change to the syntax. This document is not an Internet Standards Track specification; it is published for informational purposes.Ambiguity of Uppercase vs Lowercase in RFC 2119 Key WordsRFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.Informative ReferencesAuthentication weaknesses in GCMGCM UpdateRandomness Requirements for SecuritySecurity systems are built on strong cryptographic algorithms that foil pattern analysis attempts. However, the security of these systems is dependent on generating secret quantities for passwords, cryptographic keys, and similar quantities. The use of pseudo-random processes to generate secret quantities can result in pseudo-security. A sophisticated attacker may find it easier to reproduce the environment that produced the secret quantities and to search the resulting small set of possibilities than to locate the quantities in the whole of the potential number space.Choosing random quantities to foil a resourceful and motivated adversary is surprisingly difficult. This document points out many pitfalls in using poor entropy sources or traditional pseudo-random number generation techniques for generating such quantities. It recommends the use of truly random hardware techniques and shows that the existing hardware on many systems can be used for this purpose. It provides suggestions to ameliorate the problem when a hardware solution is not available, and it gives examples of how large such quantities need to be for some applications. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.Using AES-CCM and AES-GCM Authenticated Encryption in the Cryptographic Message Syntax (CMS)This document specifies the conventions for using the AES-CCM and the AES-GCM authenticated encryption algorithms with the Cryptographic Message Syntax (CMS) authenticated-enveloped-data content type. [STANDARDS-TRACK]Guidelines for Cryptographic Algorithm Agility and Selecting Mandatory-to-Implement AlgorithmsMany IETF protocols use cryptographic algorithms to provide confidentiality, integrity, authentication, or digital signature. Communicating peers must support a common set of cryptographic algorithms for these mechanisms to work properly. This memo provides guidelines to ensure that protocols have the ability to migrate from one mandatory-to-implement algorithm suite to another over time.AcknowledgementsMany thanks to
,
,
,
,
,
,
, and
for their careful review and thoughtful improvements.Author's AddressVigil Security, LLC516 Dranesville RoadHerndonVA20170United States of Americahousley@vigilsec.com