Cosio
Cosio

Reputation: 121

Get fingerprint information of a Certification file

Is there any way to get fingerprint information of a Certification file? For example I have my certRSA.cert and if I open it with windows 7 we can see all the information of the certificate (algorithm, issuer, subject, validity, public key, use of the key, FINGERPRINT...). In java I have the cert as a java object (x509Certificate):

X509Certificate certRSA = X509Certificate.getInstance(CertRSA_data);

And then for example we can get the public key:

PublicKey pubKeyUser = certRSA.getPublicKey();

The code expose above by ZZ Coder (How to retrieve/compute an X509 certificate's thumbprint in Java?) is really good, but it calculates fingerprint and what I want is to get this information (the same way as we can get public key information, or issuer or other items) of the certificate, not calculate it. Is there any way to do this?? Any comment is greatly appreciated. Thanks so much.

Upvotes: 2

Views: 5814

Answers (1)

mkl
mkl

Reputation: 96064

what I want is to get this information (the same way as we can get public key information, or issuer or other items) of the certificate, not calculate it.

The reason why you cannot get the fingerprint like you can get the public key or issuer, is that the fingerprint is not like those values, it is notpart of the certificate. Public key and issuer are part of it and, therefore, merely have to be read from the certificate, but the fingerprint is not a part of it and, consequently, has to be calculated.

Microsoft's presentation of certificates is a bit misleading because it presents the fingerprint as if it was contained in the certificate but actually Microsoft has to calculate the fingerprint, too. This is especially misleading because a certificate actually has many fingerprints, and Microsoft only displays the fingerprint it seems to use internally, i.e. the SHA-1 fingerprint.

Upvotes: 5

Related Questions