
SPKI pin (HPKP-style)
Compute the RFC 7469 pin-sha256 of a certificate or public key's SubjectPublicKeyInfo, for HTTP Public Key Pinning or certificate pinning.
SPKI pin (HPKP-style) pulls the SubjectPublicKeyInfo from a certificate or standalone public key and prints it as an RFC 7469 pin-sha256 value, base64 of that structure's SHA-256 digest. Handed a certificate, it extracts the SPKI from inside that structure first; handed a bare public key, it hashes the bytes as-is. Raw DER falls back to a bare SPKI reading.
Questions
What input types does it accept?
A PEM CERTIFICATE block, a PEM PUBLIC KEY block, or raw DER with no PEM label at all.
How does it handle a certificate versus a bare public key?
A certificate has its SubjectPublicKeyInfo extracted from inside the surrounding certificate structure first; a public key block is hashed as-is.
What does it output?
A pin-sha256="..." line in the exact RFC 7469 HPKP format.
What happens with raw DER and no PEM label?
It is tried as a certificate first, and falls back to being treated as an SPKI directly if that parse fails.
What hash does the pin use?
SHA-256 over the DER bytes of the SubjectPublicKeyInfo structure.