HackBlue

Tools · Cryptography and passwords in practice · 22 / 24

A certificate fingerprint is not the subject name

A certificate fingerprint is a digest of that certificate’s bytes. The subject name is a field inside it. Two certificates can share a name and have different fingerprints. Write both.

9 min read · practice only with authorization

The fingerprint identifies the certificate

A fingerprint command hashes the certificate encoding and prints the digest. That digest changes if the certificate bytes change. It is how you tell two files apart when both claim a similar name.

The algorithm on the fingerprint matters. A SHA-256 fingerprint and a SHA-1 fingerprint of the same certificate are different strings. Write the algorithm with the hex.

The name is a field

The subject common name, and the subject alternative names, are fields in the certificate. They are what a verifier compares to a hostname when it is doing that check. They are not the fingerprint. A matching name does not mean a matching fingerprint.

If you did not print the names, write “subject not in the note.” Do not reconstruct a name from a filename.

What to write down

File the fingerprint algorithm, the fingerprint, and the subject or SAN you actually printed. If two files share a name, file both fingerprints and do not merge them.

Lab: two lab certificates with one name

lab-a.pem and lab-b.pem both show a subject name lab.example. Their SHA-256 fingerprints differ. A draft says they are the same certificate because the name matches, and keeps only the first fingerprint.

The note lists both filenames and both fingerprints. The shared name is a field on each. They are two certificates. The second fingerprint is not dropped.

Snippet
lab-a.pem  subject: lab.example  SHA-256 fingerprint: value A
lab-b.pem  subject: lab.example  SHA-256 fingerprint: value B
A and B differ
write: two certificates
not: one certificate because the name matches

Diagram

Name and fingerprint answer different questions

Keep both when you record a certificate.

  • Fingerprint

    Digest of this certificate’s bytes. Say which hash.

  • Subject or SAN

    A name field inside the certificate. Not the digest.

  • Same name, different fingerprint

    Two certificates. Do not merge them.

  • Fingerprint without a name

    Say the subject was not printed.

Check yourself

1. Two files show the subject lab.example and different SHA-256 fingerprints. What are they?

2. You printed a fingerprint and not the subject. What do you write for the name?

3. Why record the hash name next to the fingerprint hex?