Asymmetric Key Packages
obsoletes
- rfc-5208 — Public-Key Cryptography Standards (PKCS) #8: Private-Key Information Syntax Specification Version 1.2
Extracted elements (20)
In general, either the public key or a certificate will be present in OneAsymmetricKey, but rarely both simultaneously, since including both results in two copies of the public key material.
The ALGORITHM-IDENTIFIER type from the original RFC 5208 was replaced with ALGORITHM from the new PKIX ASN.1 modules in RFC 5912, and imports were changed from PKCS #5 to RFC 5911 and RFC 5912, to align with updated ASN.1 module conventions.
The name 'PrivateKeyInfo' was changed to 'OneAsymmetricKey' to reflect the addition of the optional publicKey field, allowing both parts of an asymmetric key pair to be conveyed together. Not all algorithms will use both fields, but the publicKey field was added for completeness.
OneAsymmetricKey and PrivateKeyInfo can be carried in PKCS #12 (P12) messages: private-key information in the keyBag BAG-TYPE and EncryptedPrivateKeyInfo in the pkcs8ShroudedKeyBag BAG-TYPE. File extensions .pfx and .p12 are used interchangeably in current implementations.
PEM-encoded .p8 files use the .pem extension. Encrypted keys are bracketed by '-----BEGIN ENCRYPTED PRIVATE KEY-----' / '-----END ENCRYPTED PRIVATE KEY-----'; unencrypted keys use '-----BEGIN PRIVATE KEY-----' / '-----END PRIVATE KEY-----'. The content is Base64-encoded DER.
The .pvk (Microsoft proprietary) and .p12/.pfx formats are not interchangeable with the OneAsymmetricKey format defined here, though conversion tools exist. The .pvk extension is used for local storage of Microsoft's private-key proprietary transfer syntax.
Attributes from PKCS #9 [RFC2985] MAY be supported in the OneAsymmetricKey attributes field.
For the EncryptedPrivateKeyInfo encoding process, generators SHOULD use DER and receivers MUST support BER (which also includes DER).
Generators SHOULD use DER encoding and receivers MUST support BER encoding (which also includes DER) for the asymmetric key package content type.
If the publicKey field is present in OneAsymmetricKey, then the version field MUST be set to v2; otherwise the version SHOULD be set to v1.
The PKCS #8 object inside the application/pkcs8 media type MUST be DER-encoded PrivateKeyInfo.
CMS protecting content types that MAY encapsulate the AsymmetricKeyPackage include: SignedData (digital signature), EncryptedData (symmetric encryption with pre-shared key), EnvelopedData (symmetric encryption with key transport), AuthenticatedData (MAC with key management), and AuthEnvelopedData (authenticated encryption).
PrivateKeyInfo is defined as an alias for OneAsymmetricKey to maintain backwards compatibility with RFC 5208 and PKCS #12. When version is v1 and no v2 fields are used, the structure is identical to the original RFC 5208 PrivateKeyInfo.
The AsymmetricKeyPackage CMS content type is a SEQUENCE of one or more OneAsymmetricKey elements, identified by OID id-ct-KP-aKeyPackage (joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) dod(2) infosec(1) formats(2) key-package-content-types(78) 5). It is used to transfer one or more plaintext asymmetric keys from one party to another.
The privateKey field in OneAsymmetricKey is an OCTET STRING whose content is algorithm-specific: DSA keys are INTEGER, RSA keys use RSAPrivateKey as defined in RFC 3447 (including n and e), and ECC keys use ECPrivateKey as defined in RFC 5915 (including the optional publicKey field).
This document registers the application/pkcs8 media type with IANA. The subtype carries a DER-encoded PrivateKeyInfo (OneAsymmetricKey), has no required or optional parameters, uses binary encoding, and is associated with the .p8 file extension.
Protection of private-key information is vital to public-key cryptography; disclosure to another entity can lead to masquerades. The encryption algorithm used to protect the key must be at least as strong as the key it is protecting.
The asymmetric key package contents are not inherently protected by this content type; it must be combined with a CMS security protocol (SignedData, EncryptedData, EnvelopedData, etc.) to protect the package contents. Removing encapsulating security layers will invalidate any signature and may expose the key to unauthorized disclosure.
EncryptedPrivateKeyInfo is an ASN.1 SEQUENCE containing encryptionAlgorithm (AlgorithmIdentifier for CONTENT-ENCRYPTION) and encryptedData (OCTET STRING holding the encrypted PrivateKeyInfo). Used by PKCS #12.
OneAsymmetricKey is an ASN.1 SEQUENCE containing: version (Version INTEGER v1/v2), privateKeyAlgorithm (AlgorithmIdentifier), privateKey (OCTET STRING), attributes ([0] OPTIONAL SET), and publicKey ([1] BIT STRING OPTIONAL, version 2 extension). The privateKey field's content is algorithm-specific.