Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is fingerprint of public cert unique?

I would like to store public cert in a database, but I need an attribute of the public cert to index the public certs in the database. I would like to make this a unique field.

Is the finger print of a public cert unique?

like image 248
user3697919 Avatar asked Jun 02 '14 01:06

user3697919


People also ask

Can 2 certificates have the same thumbprint?

First, given a thumbprint, it should uniquely identify a certificate (Property U1), or equivalently, no two certificates should have the same thumbprint. Second, given a certificate, there should be a unique thumbprint associated with it (Property U2).

Is a certificate fingerprint sensitive?

Fingerprints offer incredibly sensitive and strong detection of anything changed anywhere in a security certificate.

Is a certificate thumbprint private?

The certificate fingerprint is calculated from the certificate. The certificate itself is public information and transferred in clear during the SSL/TLS handshake. Which makes the fingerprint public information too, i.e. there is usually no danger in having it known by others.

Does certificate thumbprint change?

Certificate thumbprint is calculated over entire certificate, not just public key. When you renew the certificate, it is changed.


1 Answers

The fingerprint is unique (for all practical intents); two different certificates should never share the same hash. For example, per the Windows X509certificate2.thumbprint documentation:

the thumbprint is a unique value for the certificate, it is commonly used to find a particular certificate in a certificate store.

Per the OpenSSL documentation:

Because of the nature of message digests the fingerprint of a certificate is unique to that certificate and two certificates with the same fingerprint can be considered to be the same.

Note the fingerprint is not part of the certificate. Rather, it is calculated by taking a cryptographic hash of the entire certificate (including the signature). Different cryptographic implementations may use different hashing algorithms to compute the fingerprint, and thus provide different fingerprints for the same certificate. (For example, the Windows Crypto API computes the SHA-1 hash of the certificate to compute the thumbprint, whereas OpenSSL can generate the SHA-256 or SHA-1 hash.) You will thus need to ensure that clients using the database fingerprint are using the same API, or a consistent hashing algorithm.

In theory, a duplicate fingerprint shared by multiple certificates would require a hash collision. The probability of such an event occurring by chance is astronomical. Intentionally generating such a certificate pair would require a successful preimage attack on the underlying hash function, an attack not known to be feasible on SHA-1 (see Preimage Attack).

like image 148
drf Avatar answered Nov 27 '22 15:11

drf