Skip to content Skip to sidebar Skip to footer

Jsrsasign - How To Extract An X.509 Certificate's Fingerprint?

Is it possible to use jsrsasign to extract the fingerprint of an x.509 certficate, similar to what can be achieved using this openssl command: openssl x509 -sha1 -in cert.pem -noou

Solution 1:

You just need to extract the string from between the "-----BEGIN CERTIFICATE-----" header and "-----END CERTIFICATE----- " footer, base64 decode it and compute SHA1 hash of decoded data.

Solution 2:

Thank you for using jsrsasign. You can write like this:

hex = KEYUTIL.getHexFromPEM(certPEMstring);

fingerprint = KJUR.crypto.Util.hashHex(hex, 'sha256');

You can also find a fingerprint example here: http://kjur.github.io/jsrsasign/tool_certview.html

Post a Comment for "Jsrsasign - How To Extract An X.509 Certificate's Fingerprint?"