RFC 9579: Use of Password-Based Message Authentication Code 1 (PBMAC1) in PKCS #12 Syntax
- H. Kario
This RFC is now obsolete
Abstract
This document specifies additions and amendments to RFCs 7292 and 8018. It defines a way to use the Password-Based Message Authentication Code 1 (PBMAC1), defined in RFC 8018, inside the PKCS #12 syntax. The purpose of this specification is to permit the use of more modern Password-Based Key Derivation Functions (PBKDFs) and allow for regulatory compliance.¶
Status of This Memo
This document is not an Internet Standards Track specification; it is published for informational purposes.¶
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). Not all documents approved by the IESG are candidates for any level of Internet Standard; see 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 PKCS #12 format [RFC7292] is widely used for the interoperable transfer of certificate, key, and other miscellaneous secrets between machines, applications, browsers, etc. Unfortunately, [RFC7292] mandates the use of a PKCS #12 specific password-based key derivation function that only allows for change of the underlying message digest function.¶
2. Rationale
Due to security concerns with the key derivation function from [RFC7292] and the much higher extensibility of PBMAC1 [RFC8018], we propose the use of PBMAC1 for integrity protection of PKCS #12 structures. The new syntax is designed to allow legacy applications to still be able to decrypt the key material, even if they are unable to interpret the new integrity protection, provided that they can ignore failures in Message Authentication Code (MAC) verification. This change allows for the use of PBKDF2 [RFC8018] or scrypt PBKDFs [RFC7914] for derivation of MAC keys and future extensibility. Use of the extensible PBMAC1 mechanism also allows for greater flexibility and alignment with different government regulations, for example, in environments where PBKDF2 is the only allowed password-based key derivation function.¶
As the recommended methods for key protection require both encryption and integrity protection, we decided to amend the PKCS #12 format to support different key derivation functions rather than extending the PKCS #5 format by a new field that allows integrity protection.¶
We included an ASN.1 module [x680] [x681] [x682] [x683] [x690] that can be combined with the ASN.1 modules in [RFC7292] and [RFC8018] to incorporate additional MAC algorithms.¶
3. Requirements Language
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.¶
4. Embedding PBMAC1 in PKCS #12
The MacData structure in the PFX object, as described in item #3 in Section 4 of [RFC7292], is updated to include the following PBMAC1-specific guidance:¶
5. Recommended Parameters
To provide interoperabilit
The length of the key generated by the used KDF MUST be encoded explicitly in the parameters field and SHOULD be the same size as the HMAC function output size. This means that PBMAC1-params specifying SHA-256 HMAC should also include KDF parameters that generate a 32-octet key. In particular, when using the PBKDF2, implementations MUST include the keyLength field in the encoded PBKDF2-params. Implementations MUST NOT accept PBKDF2 KDF with PBKDF2-params that omit the keyLength field.¶
6. Password Encoding
As documented in Appendix B.1 of [RFC7292], the handling of password encoding in the underlying standards is underspecified. However, just as with PBES1 and PBES2 when used in the context of PKCS #12 objects, all passwords used with PBMAC1 MUST be created from BMPStrings with a NULL terminator.¶
7. Deprecated Algorithms
While attacks against SHA-1 HMACs are not considered practical
[RFC6194] to limit the number of algorithms needed
for interoperabilit
8. IANA Considerations
IANA has registered the following object identifier in the
"SMI Security for S/MIME Module Identifier
9. Security Considerations
Except for the use of different key derivation functions, this document doesn't change how the integrity protection on PKCS #12 objects is computed; therefore, all the security considerations from [RFC7292] apply.¶
Use of PBMAC1 and PBKDF2 is unchanged from [RFC8018]; therefore, all the security considerations from [RFC8018] apply.¶
The KDFs generally don't have a lower limit for the generated
key size, allowing the specification of very small key sizes (of 1 octet), which
can facilitate brute-force attacks on the HMAC.
Since the KDF parameters are not cryptographical
10. References
10.1. Normative References
- [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 - [RFC6194]
-
Polk, T., Chen, L., Turner, S., and P. Hoffman, "Security Considerations for the SHA-0 and SHA-1 Message-Digest Algorithms", RFC 6194, DOI 10
.17487 , , <https:///RFC6194 www >..rfc -editor .org /info /rfc6194 - [RFC7292]
-
Moriarty, K., Ed., Nystrom, M., Parkinson, S., Rusch, A., and M. Scott, "PKCS #12: Personal Information Exchange Syntax v1.1", RFC 7292, DOI 10
.17487 , , <https:///RFC7292 www >..rfc -editor .org /info /rfc7292 - [RFC8018]
-
Moriarty, K., Ed., Kaliski, B., and A. Rusch, "PKCS #5: Password-Based Cryptography Specification Version 2.1", RFC 8018, DOI 10
.17487 , , <https:///RFC8018 www >..rfc -editor .org /info /rfc8018 - [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 - [SHA2]
-
National Institute of Standards and Technology (NIST), "Secure Hash Standard (SHS)", FIPS PUB 180-4, DOI 10
.6028 , , <https:///NIST .FIPS .180 -4 nvlpubs >..nist .gov /nistpubs /FIPS /NIST .FIPS .180 -4 .pdf - [x680]
-
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 - [x681]
-
ITU-T, "Information technology - Abstract Syntax Notation One (ASN.1): Information object specification", ITU-T Recommendation X.681, ISO/IEC 8824-2:2021, , <https://
www >..itu .int /rec /T -REC -X .681 - [x682]
-
ITU-T, "Information technology - Abstract Syntax Notation One (ASN.1): Constraint specification", ITU-T Recommendation X.682, ISO/IEC 8824-3:2021, , <https://
www >..itu .int /rec /T -REC -X .682 - [x683]
-
ITU-T, "Information technology - Abstract Syntax Notation One (ASN.1): Parameterizatio
n of ASN.1 specifications" , ITU-T Recommendation X.683, ISO/IEC 8824-4:2021, , <https://www >..itu .int /rec /T -REC -X .683 - [x690]
-
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
10.2. Informative References
- [RFC7914]
-
Percival, C. and S. Josefsson, "The scrypt Password-Based Key Derivation Function", RFC 7914, DOI 10
.17487 , , <https:///RFC7914 www >..rfc -editor .org /info /rfc7914 - [SHA3]
-
National Institute of Standards and Technology (NIST), "SHA-3 Standard: Permutation
-Based Hash and Extendable , FIPS PUB 202, DOI 10-Output Functions" .6028 , , <https:///NIST .FIPS .202 nvlpubs >..nist .gov /nistpubs /FIPS /NIST .FIPS .202 .pdf
Appendix A. Test Vectors
All test vectors use "1234" as the password for both encryption and integrity protection.¶
A.1. Valid PKCS #12 File with SHA-256 HMAC and PRF
The following base64-encoded PKCS #12 file MUST be readable by implementations following this RFC.¶
A.2. Valid PKCS #12 File with SHA-256 HMAC and SHA-512 PRF
The following base64-encoded PKCS #12 file SHOULD be readable by implementations following this RFC.¶
A.3. Valid PKCS #12 File with SHA-512 HMAC and PRF
The following base64-encoded PKCS #12 file SHOULD be readable by implementations following this RFC.¶
A.4. Invalid PKCS #12 File with Incorrect Iteration Count
The following base64-encoded PKCS #12 file MUST NOT be readable by an implementation following this RFC when it is verifying integrity protection.¶
A.5. Invalid PKCS #12 File with Incorrect Salt
The following base64-encoded PKCS #12 file MUST NOT be readable by an implementation following this RFC when it is verifying integrity protection.¶
A.6. Invalid PKCS #12 File with Missing Key Length
The following base64-encoded PKCS #12 file MUST NOT be readable by an implementation following this RFC when it is verifying integrity protection.¶
Appendix B. ASN.1 Module
This appendix documents ASN.1 [x680] [x681] [x682] [x683] [x690] types, values,
and object sets for this specification. It does so by providing an
ASN.1 module called PKCS12
Combine this module with the PKCS-12 ASN.1 module found in Appendix D of [RFC7292] and the pkcs5v2-1 ASN.1 module in Appendix C of [RFC8018] to add SHA-2-based HMACs by replacing the PBKDF2-PRFs class referenced from [RFC7292].¶