Network Working Group Sean Turner, IECA Internet Draft3020 October20082009 Intended Status: Standard TrackObsoletes:Updates: RFC 5208 (once approved) Expires:3020 April20092010 Asymmetric Key Packagesdraft-turner-asymmetrickeyformat-01.txtdraft-turner-asymmetrickeyformat-02.txt Status of this MemoBy submitting this Internet-Draft, each author represents that any applicable patent or other IPR claimsThis Internet-Draft is submitted to IETF in full conformance with the provisions ofwhich heBCP 78 and BCP 79. This document may contain material from IETF Documents orshe is aware have beenIETF Contributions published orwillmade publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not bedisclosed,modified outside the IETF Standards Process, andanyderivative works ofwhich he or she becomes aware willit may not bedisclosed, in accordance with Section 6 of BCP 79.created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html This Internet-Draft will expire on3020 April2009.2010. Copyright Notice Copyright(C) The(c) 2009 IETF Trust(2008).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 (http://trustee.ietf.org/license-info). Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Abstract This document defines the syntax for private key information and a content type for it. Private-key information includes a private key forsomea specified public-key algorithm and a set of attributes. Thedocument also describes a syntax for encrypted private keys. TheCryptographic MessageSyntax,Syntax (CMS), as defined in RFC 3852, can be used to digitally sign, digest, authenticate, or encrypt the asymmetric key format content type. This documentobsoletesupdates RFC 5208.Table of Contents 1. Introduction...................................................2 1.1. Requirements Terminology..................................2 1.2. ASN.1 Syntax Notation.....................................2 1.3. Changes since RFC 5208....................................2 2. Asymmetric Key Package Content Type............................3 3. Encrypted Private Key Info.....................................5 4. Protecting the AsymmetricKeyPackage............................5 5. Other Considerations...........................................6 6. Security Considerations........................................6 7. IANA Considerations............................................7 8. References.....................................................7 8.1. Normative References......................................7 8.2. Non-Normative References..................................7 APPENDIX A: ASN.1 Module..........................................91. Introduction This document defines the syntax for private key information and a Cryptographic Message Syntax (CMS) [RFC5652] content type for it. Private-key information includes a private key forsomea specified public-key algorithm and a set of attributes. Thedocument also describes a syntax for encrypted private keys. The Cryptographic Message Syntax [RFC3852]CMS can be used to digitally sign, digest, authenticate, or encrypt the asymmetric key format content type. This documentobsoletesupdates PKCS#8 v1.2[RFC5208].[RFC5208] sections 5 and 7, and it adds two new sections; the first covers protecting the Asymmetric Key Content Type, and the second discusses compatibility with other private-key formats. 1.1. Requirements Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. 1.2. ASN.1 Syntax Notation The key package is defined using ASN.1 [X.680], [X.681], [X.682], and [X.683]. 1.3.Changes sinceSummary of Updates to RFC 5208 The followingaresummarizes thechanges sinceupdates to [RFC5208]: - Changed the name "PrivateKeyInfo" to "OneAsymmetricKey". This reflects the addition of the public key field to allow both parts of the asymmetric key to be conveyed separately. Not all algorithms will use both fields; however, the publicKey field was added for completeness. - Defined Asymmetric Key Package CMS content type. - Removed redundant IMPLICIT fromaKeyAttrs to align text with module.attributes. - Addedpublic keypublicKey to OneAsymmetricKey andadded newupdated the version number. - Added that PKCS#9 attributesMAYmay be supported. - AddedOther Considerations section.discussion of compatibility with other private-key formats. - Added requirements for encoding rule set. - Changed imports from PKCS#5 to [RFCTBD3]. 2. Asymmetric Key Package CMS Content Type This section updates section 5 of [RFC5208]. The asymmetric key package CMS content type is used to transfer one or more plaintext asymmetric keys from one party to another. An asymmetric key package MAY be encapsulated in one or more CMS protecting content types (see Section 4).This content type MUSTEarlier versions of this specification [RFC5208] did not specify a particular encoding rule set, but generators SHOULD use DER [X.690] and receivers SHOULD be prepared to handle BER [X.690] and DERencoded[X.690]. The asymmetric key package content type has the following syntax: PKCS7-CONTENT-TYPE ::= TYPE-IDENTIFIER asymmetric-key-package PKCS7-CONTENT-TYPE ::= { AsymmetricKeyPackage IDENTIFIED BY id-ct-KP-aKeyPackage } id-ct-KP-aKeyPackage OBJECT IDENTIFIER ::=|{ TBD } AsymmetricKeyPackage ::= SEQUENCE SIZE (1..MAX) OF OneAsymmetricKey OneAsymmetricKey ::= SEQUENCE { version Version, privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, privateKey PrivateKey,-- DER encodedattributes [0] Attributes OPTIONAL, publicKey [1] PublicKey OPTIONAL } PrivateKeyInfo ::= OneAsymmetricKey --UsedPrivateKeyInfo is used by [P12]. If version is set to 1, -- publicKey MUST be absent. When v1, PrivateKeyInfo is the same -- as it was in[P12][RFC5208]. Version ::= INTEGER { v1(0), v2(1) } (v1, v2,...) PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier { { PrivateKeyAlgorithms } } PrivateKey ::= OCTET STRING -- Content varies based on type of key. The -- algorithm identifier dictates the format of -- the key.DSA's is an INTEGER ECDSA's is an -- INTEGER, and RSA is as per [RFC3447].PublicKey ::=OCTETBIT STRING -- Content varies based on type of key. The -- algorithm identifier dictates the format of -- the key.DSA is an INTEGER, ECDSA is an OCTET -- STRING, and RSA is a sequence of two INTEGERs -- [PKI-ALG].Attributes ::= Set of Attribute The AsymmetricKeyPackage contains one or more OneAsymmetricKey elements. The syntax of OneAsymmetricKey accommodates a version number, an indication of the asymmetric algorithm to be used with the private key, a private key,and optionallyoptional keying material attributes (e.g.,certificates)userCertificate from [X.520]), andaan optional public key. In general, either the public key or the certificate will be present. In very rare cases will both the public key and the certificate be present as this includes two copies of the public key. OneAsymmetricKey is a renamed extension of the PrivateKeyInfo syntax defined in [RFC5208]. The new name better reflects the ability to carry both private and public key components. Backwards compatibility with the original PrivateKeyInfo is preserved via version number. The fields in OneAsymmetricKey are used as follows: - version identifiesversion oftheasymmetric key package content structure. For thisversion ofthe specification, version MUST be v1 if theOneAsymmetricKey. If publicKeyfieldisabsent and it MUST bepresent, then version is setto v2 if the publicKey field2 else version ispresent.set to 1. - privateKeyAlgorithm identifies theprivate keyprivate-key algorithm and optionally contains parameters associated with the asymmetric key. The algorithm is identified by anOIDobject identifier (OID) and theparametersformat of the parameters depends on the OID. The value placed in privateKeyAlgorithmIdentifier is the value an originator would apply to indicate which algorithmwas used.is to be used with the private key. - privateKey is an OCTET STRING whose contentsisare the value of theDER encodedprivate key. The interpretation of the contents is defined in the registration of the private-key algorithm. For example, a DSA key is an INTEGER, an RSA key is represented as RSAPrivateKey as defined in [RFC3447], and an ECC key is represented as ECPrivateKey as defined in [RFCTBD2]. - attributes is optional. It contains information corresponding to the public key (e.g., certificates). The attributes field uses the class ATTRIBUTE which is restricted by the SupportedAttributes parameterized type. SupportedAttributes is an open ended set in this document. Others documents can constrain these values. Attributes from [RFC2985] MAY be supported. - publicKey is optional. When present, it contains the public key encoded as an OCTET STRING. The structure within the octet string, if any, depends on the privateKeyAlgorithm.3. Encrypted Private Key Info This section gives the syntax for encrypted private-key information, whichFor example, a DSA key isused with [P12]. Encrypted private-key information shall have ASN.1 type EncryptedPrivateKeyInfo: EncryptedPrivateKeyInfo ::= SEQUENCE { encryptionAlgorithm EncryptionAlgorithmIdentifier, encryptedData EncryptedData } EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier { { KeyEncryptionAlgorithms } } EncryptedData ::= OCTET STRING The EncAsymmetricKeyPackage contains one or more EncryptedPrivateKeyInfo elements. The fieldsan INTEGER. Other documents may define additional private key formats. Note that RSA public keys are included inEncryptedPrivateKeyInfoRSAPrivateKey (i.e., n and e areusedpresent), asfollows: - encryptionAlgorithm identifies the algorithm under which the private-key information is encrypted. Implementations MUST support the TBD algorithm. - encryptedData is the result of encrypting the private-key informationper [RFC3447], and ECC public keys are included in ECPrivateKey (i.e., in thePrivateKeyInfo). The encryption process involves the following two steps: 1. The private-key information is BER encoded, yielding an octet string. 2. The result of step 1 is encrypted with the secret key to give an octet string, the result of the encryption process. 4.publicKey field), as per [RFCTBD2]. 3. Protecting the AsymmetricKeyPackage CMS[RFC3852] and [RFC5083]protecting contenttypestypes, [RFC5652] and [RFC5083], can be used to provide security to the AsymmetricKeyPackage: - SignedData can be used to apply a digital signature to the AsymmetricKeyPackage. - EncryptedData can be used to encrypt the AsymmetricKeyPackage to provide confidentiality but does not distribute the content encryption keys. - EnvelopedData can be used to encrypt the AsymmetricKeyPackage with simple symmetric encryption, where the sender and the receiver already share the necessary encryption key. - AuthenticatedData can be used to protect the AsymmetricKeyPackage with message authentication codes, where key management information is handled in a manner similar to EnvelopedData. - AuthEnvelopedData can be used to protect theAsymmetricKeypackageAsymmetricKeyPackage with algorithms that support authenticated encryption, where key management information is handled in a manner similar to EnvelopedData.5.4. Other Private-Key Format Considerations This document defines the syntax and the semantics for a contenttypestype thatexchangeexchanges asymmetric private keys. There are two otherstandardsformats that have been used fortransportingthe transport of asymmetric private keys: - Personal Information Exchange (PFX)orSyntax Standard [P12], which is more commonly referred to asP12 [P12],PKCS #12 or simply P12, is a transfer syntax for personal identity information, including private keys, certificates, miscellaneous secrets, and extensions.Both PrivateKeyInfoOneAsymmetricKey, PrivateKeyInfo, and EncryptedPrivateKeyInfo [RFC5208] can be carried in a P12 message.- Microsoft's Exchange Security format, which is a proprietary format. When locally storingThe privatekeys,key information, OneAsymmetricKey and PrivateKeyInfo, are carried in thefile formatP12 keyBag BAG-TYPE. EncryptedPrivateKeyInfo iseither a DER encoded file withcarried in the P12 pkcs8ShroudedKeyBag BAG-TYPE. In current implementations, the fileextensionextensions .pfx and .p12or a PEM encodedcan be used interchangeably. - Microsoft's private key proprietary transfer syntax. The .pvk filewithextension is used for local storage. The .pvk and .p12/.pfx formats are not interchangeable; however, conversion tools exist to convert from one format to another. [RFCTBD3] defines the appication/pkcs8 media type and .p8 fileextension .pem. Whenextension. To extract the private keyis a character string,information from theOCTET STRING contains an embedded UTF8String. 6. Security Considerations Protection ofAsymmetricKeyPackage, theprivate-key information is vitalencapsulating layers need topublic-key cryptography. Disclosure ofbe removed. At a minimum, theprivate-key material to another entity can leadouter ContentInfo [RFC5652] layer needs tomasquerades. The encryption algorithm usedbe removed. If the AsymmetricKeyPackage is encapsulated in a SignedData [RFC5652], then theencryption process mustSignedData and EncapsulatedContentInfo layers [RFC5652] also need to be removed. The same is true for EnvelopedData, EncryptedData, and AuthenticatedData all from [RFC5652] as'strong'well as AuthEnvelopedData from [RFC5083]. Once all the outer layers are removed, there are as many sets of private keyitinformation as there are OneAsymmetricKey structures. OneAsymmetricKey and PrivateKeyInfo are the same structure; therefore, either can be saved as a .p8 file or copied in to the P12 KeyBack BAG-TYPE. Removing encapsulating security layers will invalidate any signature and may expose the key to unauthorized disclosure. .p8 files are sometimes PEM encoded. When .p8 files are PEM encoded they use the .pem file extension. PEM encoding isprotecting.the Base64 encoding [RFC2045] of either the DER encoded EncryptedPrivateKeyInfo sandwiched between: -----BEGIN ENCRYPTED PRIVATE KEY----- -----END ENCRYPTED PRIVATE KEY----- or the PrivateKeyInfo or the OneAsymmetricKey sandwiched between: -----BEGIN PRIVATE KEY----- -----END PRIVATE KEY----- 5. Security Considerations The security considerations in [RFC5208] also apply to this document. The asymmetric key package contents are not protected. This content type can be combined with a security protocol to protect the contents of the package.The encrypted asymmetric key package contents are protected; as noted above the encryption algorithm must be as 'strong' as the key it is protecting. 7.6. IANA Considerations None: All identifiers are already registered. Please remove this section prior to publication as an RFC.8.7. References8.1.7.1. Normative References [RFC2045] Freed, .N, and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, November 1996. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.[RFC3852][RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)",RFC3852, July 2004.RFC 5652, September 2009. [RFC5208] Kaliski, B., "PKCS #8: Private Key Information Syntax Standard Version 1.2", RFC 5208, May 2008. [RFCTBD1] Schaad, J., and P. Hoffman, "New ASN.1 Modules for PKIX", draft-ietf-pkix-new-asn1-07.txt, work-in-progress. [RFCTBD3] Jennings C., and J. Fischl "Certificate Management Service for The Session Initiation Protocol (SIP)", draft-ietf-sip-certs-09.txt, work-in-progress. [X.680] ITU-T Recommendation X.680 (2002) | ISO/IEC 8824-1:2002. Information Technology - Abstract Syntax Notation One. [X.681] ITU-T Recommendation X.681 (2002) | ISO/IEC 8824-2:2002. Information Technology - Abstract Syntax Notation One: Information Object Specification. [X.682] ITU-T Recommendation X.682 (2002) | ISO/IEC 8824-3:2002. Information Technology - Abstract Syntax Notation One: Constraint Specification. [X.683] ITU-T Recommendation X.683 (2002) | ISO/IEC 8824-4:2002. Information Technology - Abstract Syntax Notation One: Parameterization of ASN.1 Specifications. [X.690] ITU-T Recommendation X.690 (2002) | ISO/IEC 8825-1:2002. Information Technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER).8.2.7.2. Non-Normative References [P12] RSA Laboratories, "PKCS #12 v1.0: Personal Information Exchange Syntax", June 1999. [RFC2985] Nystrom, M., and B. Kaliski, "PKCS #9: Selected Object Classes and Attribute Types Version 2.0", RFC 2985, November 2000. [RFC3447] Jonsson, J., and B. Kaliski," Public-Key"Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1", RFC 3447, February 2003.[RFC5208] Kaliski, B., "PKCS #8: Private Key Information Syntax Standard Version 1.2", RFC 5208, May 2008.[RFC5083] Housley, R., "Cryptographic Message Syntax (CMS) Authenticated-Enveloped-Data Content Type", RFC 5083, November 2007.[PKI-ALG][X.520] ITU-T Recommendation X.520 (2005) | ISO/IEC 9594-6:2005, Information technology - Open Systems Interconnection - The Directory: Selected attribute types. [RFCTBD2] Turner, S.,Brown, D., Yiu, K., Housley, R.,andT. Polk, "Elliptic Curve Cryptography Subject PublicD. Brown, "EC Private KeyInformation", draft- ietf-pkix-ecc-subpubkeyinfo, work-in-progress.Info Structure", draft-turner-ecprivatekey-00.txt, work-in- progress. APPENDIX A: ASN.1 Module This annex provides the normative ASN.1 definitions for the structures described in this specification using ASN.1 as defined in [X.680] through [X.683]. AsymmetricKeyPackageModulev1 { tbd } DEFINITIONS IMPLICIT TAGS ::= BEGIN -- EXPORTS ALL IMPORTS NOTHING Attribute{},ATTRIBUTE, AlgorithmIdentifier{}ATTRIBUTE FROM PKIX-CommonTypes-2009 -- FROMPKIX-CommonTypes[RFCTBD1] { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0)id-mod-pkixCommon(43)id-mod-pkixCommon-02(57) }id-aes128-wrap, id-aes192-wrap, id-aes1256-wrapAlgorithmIdentifier{} FROMCMSAesRsaesOaepAlgorithmInformation-2009 -- FROM [RFCTBD1] { iso(1)member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) modules(0) id-mod-cms-aes(19)identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-mod-algorithmInformation-02(58) } ; PKCS7-CONTENT-TYPE ::= TYPE-IDENTIFIER KeyPackageContentTypes PKCS7-CONTENT-TYPE ::= {asymmetric-key-package |asymmetric-key-package, ... -- Expect additional content types -- } asymmetric-key-package PKCS7-CONTENT-TYPE ::= { AsymmetricKeyPackage IDENTIFIED BY id-ct-KP-aKeyPackage } id-ct-KP-aKeyPackage OBJECT IDENTIFIER ::= { TBD } AsymmetricKeyPackage ::= SEQUENCE SIZE (1..MAX) OF OneAsymmetricKey OneAsymmetricKey ::= SEQUENCE { version Version, privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, privateKey PrivateKey,-- DER encodedattributes [0] Attributes OPTIONAL, publicKey [1] PublicKey OPTIONAL } PrivateKeyInfo ::= OneAsymmetricKey -- PrivateKeyInfo is used by [P12]. If version is set to 1, -- publicKey MUST be absent. When v1, PrivateKeyInfo is the same -- as it was in [RFC5208]. Version ::= INTEGER {v1(0), v2(1)} (v1, v2,...) PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier { { PrivateKeyAlgorithms } } PrivateKey ::= OCTET STRING -- Content varies based on type ofkeykey. The --DSA is INTEGER, ECDSA is ECPublicKeyalgorithm identifier dictates the format of -- the key. PublicKey ::=OCTETBIT STRING -- Content varies based on type of key. The -- algorithm identifier dictates the format of -- the key. Attributes ::= Set of Attribute { {SupportAttributesSupportedAttributes } } SupportedAttributes ATTRIBUTE :: { ... -- For local profiles } EncryptedPrivateKeyInfo ::= SEQUENCE { encryptionAlgorithm EncryptionAlgorithmIdentifier, encryptedData EncryptedData } EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier { { KeyEncryptionAlgorithms } } EncryptedData ::= OCTET STRING -- Encrypted PrivateKeyInfo PrivateKeyAlgorithms ALGORITHM-IDENTIFIER ::= { ... -- Extensible } KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {id-aes128-wrap | id-aes192-wrap | id-aes256-wrap,... -- Extensible } END Acknowledgements Many thanks go out to the Burt Kaliski and Jim Randall at RSA. Without the prior version of the document, this one wouldn't exist. We'd also like to thank PasiEronen andEronen, RussHousley.Housley, and Carl Wallace. Author's Address Sean Turner IECA, Inc. 3057 Nutley Street, Suite 106 Fairfax, VA 22031 USA Email: turners@ieca.comFull Copyright Statement Copyright (C) The IETF Trust (2008). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights. This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Intellectual Property The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf- ipr@ietf.org. Acknowledgment Funding for the RFC Editor function is provided by the IETF Administrative Support Activity (IASA).