Inspect and display properties of public keys.
Public keys are designed to be shared openly. However, just sending the raw mathematical numbers (like an RSA modulus) isn't enough—the receiving computer needs to know what algorithm to use.
To solve this, public keys are universally formatted using Subject Public Key Info (SPKI) (part of the X.509 standard). The SPKI structure contains two parts:
A Public Key is hundreds or thousands of characters long. If you want to verify that a server gave you the correct public key over the phone, reading it out loud is impossible.
Instead, we generate a Fingerprint (or Thumbprint). We take the raw DER bytes of the SPKI file and hash them using SHA-256. This produces a short, fixed-length hexadecimal string (e.g., a1:b2:c3...). If two keys have the same fingerprint, they are mathematically guaranteed to be the exact same key.
A common friction point for developers is that OpenSSH (used for GitHub or connecting to Linux servers) uses a completely different, proprietary format for public keys (e.g., ssh-rsa AAAAB3Nza...).
SSH public keys do not use SPKI or ASN.1 DER. They use a simple length-prefixed string format. If you try to pass an SSH public key to an SSL/TLS system (which expects SPKI/PEM), it will fail to parse.
What is the primary purpose of the SPKI format?