28

I have some SW that extracts certificates data and the SW utilizes OpenSSL. I am confused what is the difference between the subjectKeyIdentifier and the sha1Fingerprint. Both are hash values. My intuition is that the subjectKeyIdentifier is the hash of the public-key of the certificate and the sha1Fingerprint is the hash of the overall fields of the certificate. This reference says about the subjectKeyIdentifier:

This is a hash value of the SSL certificate.

This is an example of what I get from the SW:

"subjectKeyIdentifier": "A8:XX:6A:XX:04:7D:DD:BA:E6:D1:XX:XX:XX:45:65:EF:F3:XX:EC:XX", "sha1Fingerprint": "E6:XX:XX:5B:06:XX:50:9B:XX:82:XX:2D:XX:6E:XX:97:XX:95:XX:CB"

Note: XX in the examples is used for redaction.

The question is: What is the difference between the two hashes? What each hash is for?

1 Answer 1

44

The subject key identifier (SKID) is an x509 extension and thus actually part of the certificate. The fingerprint instead is not part of the certificate but instead computed from the certificate. A certificate does not need to have an SKID at all and can have at most one SKID. But since the fingerprint is just a computed from the certificate there can be multiple fingerprints, like one using SHA-1, one using SHA-256, one using MD5 ...

The SKID is used to create the trust chain not based on the certificate subject and issuer but on the certificate SKID and authority key identifier (AKID). This makes it easier to deal with situations where the same subject string is used with multiple CA certificates. While the RFC 3280 describes common ways to generate SKID the only real requirement is that the SKID of the CA certificate must match the AKID in all certificates issued by this CA.

In the example below it can be clearly seen that the SKID BB:AF:7E:02:3D:FA:... of the issuer matches the AKID of the issued certificate:

    ...
    Issuer: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Certification Authority
    ...
    Subject: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Domain Validation Secure Server CA
    ...
    X509v3 extensions:
        X509v3 Authority Key Identifier: 
            keyid:BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4

    ----

    ...
    Issuer: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Certification Authority
    ...
    Subject: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Certification Authority
    ...
    X509v3 extensions:
        X509v3 Subject Key Identifier: 
            BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4
11
  • 12
    It might be worth mentioning that the SKI is calculated from the Subject and Public Key while the fingerprint is generated from the whole certificate. If a certificate is renewed, its SKI will stay the same, while its fingerprint will change. Commented Dec 24, 2018 at 8:06
  • @garethTheRed SKI remains the same only when key pair is reused during renewal. If new key pair is generated, it will produce new SKI value.
    – Crypt32
    Commented Dec 24, 2018 at 9:42
  • 3
    @garethTheRed: the SKI might be derived from subject and pubkey in specific (and likely many) implementations but it is not required to be done this way. From RFC 3280 section 4.2.1.2: "For CA certificates, subject key identifiers SHOULD be derived from the public key or a method that generates unique values.". But of course SKI cannot be derived from the whole certificate since the SKI itself is part of the certificate. Commented Dec 24, 2018 at 10:13
  • 3
    @Crypt32 - that will be a re-key, not a renewal; by RFC 3647 definition. Although renewal is often used to describe both in practice. Commented Dec 24, 2018 at 10:30
  • 2
    @user9371654: the SKI is somehow related to the public key and can also be related to others (subject makes sense). It does not have to be a hash of these - it can also be some random as long as the same number is used for all certificates issued by this specific CA (and also renews of the CA using the same subject and key) and other CA certificates use different numbers. Of course, just using a hash of public key and subject would be a simple implementation which provides these properties. But it is not a requirement to implement it like this. Commented Dec 24, 2018 at 15:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .