Reputation: 41
I am using node-forge distribution from below link
https://github.com/digitalbazaar/forge-dist/blob/master/dist/forge.min.js
How to get Certificate thumbprint in my application using node-forge as cross platform application. My application is connection to some domain like www.anydomain.com every time it makes ajax call to get the data from the services. I want to read certificate thumbprint to apply some logic.
Please help if anybody have the solution.
Upvotes: 4
Views: 2141
Reputation: 11990
It's not really straightforward, but (if your certificate is cert
variable):
const md = forge.md.sha1.create();
md.update(forge.asn1.toDer(forge.pki.certificateToAsn1(cert)).getBytes());
const hex = md.digest().toHex();
Upvotes: 8