7.2 Algorithms

algorithmKeyPublic keyPrivate key
1ECDSA over NIST P-256id-ecPublicKey, curve secp256r1 (RFC 5480)ECPrivateKey (RFC 5915)
2ECDSA over NIST P-384id-ecPublicKey, curve secp384r1 (RFC 5480)ECPrivateKey (RFC 5915)
3RSA, 2048-bit modulusrsaEncryption (RFC 8017)RSAPrivateKey (RFC 8017)
4RSA, 3072-bit modulusrsaEncryption (RFC 8017)RSAPrivateKey (RFC 8017)
5RSA, 4096-bit modulusrsaEncryption (RFC 8017)RSAPrivateKey (RFC 8017)

public_key is the key's DER SubjectPublicKeyInfo (RFC 5280), with the algorithm identifier the table names. An elliptic-curve public key is the uncompressed point. A writer MUST write the canonical DER encoding, so that one key always has one encoding.

The private key is a version 1 PKCS #8 PrivateKeyInfo (RFC 5208) carrying the key's own private-key structure from the table, with the same algorithm identifier as public_key.

An RSA key's algorithm is fixed by the length of its modulus: an RSA key of any other size can't be held in a version 1 key file.

Edit this page