Skip to content
ecdsa.com

SubjectPublicKeyInfo (SPKI)

The ASN.1 structure from RFC 5280 that pairs an algorithm identifier with the public key bits, used inside every X.509 certificate and as the standard public key file format (-----BEGIN PUBLIC KEY-----).
Also written asSubjectPublicKeyInfoBEGIN PUBLIC KEYX.509 public keyPKIX public key

SubjectPublicKeyInfo is a SEQUENCE of an AlgorithmIdentifier and the subjectPublicKey BIT STRING. For EC keys the algorithm is id-ecPublicKey with the curve OID as parameter and the bit string holds the SEC 1 point; for RSA it is rsaEncryption with NULL parameters and a PKCS #1 RSAPublicKey inside; for Ed25519 it is 1.3.101.112 with no parameters and 32 bytes. DER sizes: 91 bytes for P-256, 294 for RSA-2048, 44 for Ed25519.

It is the interchange format for public keys: OpenSSL -pubout, Java's X509EncodedKeySpec, Go's x509.MarshalPKIXPublicKey, WebCrypto's spki export and most JWT libraries. Hashes of the SPKI are used as key-level identifiers that survive certificate renewal: HPKP-style pins (pin-sha256), Certificate Transparency monitoring and Chrome's CRLSets.

Standards and references

All terms