admin管理员组文章数量:1336340
Is it possible to use jsrsasign to extract the fingerprint of an x.509 certficate, similar to what can be achieved using this openssl mand:
openssl x509 -sha1 -in cert.pem -noout -fingerprint
- Ref: openssl x.509 doc
I'm reading my X509 like so:
var c = new X509();
c.readCertPEM(cert);
\\ how to get the fingerprint?
Ref: jsrsasign x.509 apidoc
Is it possible to use jsrsasign to extract the fingerprint of an x.509 certficate, similar to what can be achieved using this openssl mand:
openssl x509 -sha1 -in cert.pem -noout -fingerprint
- Ref: openssl x.509 doc
I'm reading my X509 like so:
var c = new X509();
c.readCertPEM(cert);
\\ how to get the fingerprint?
Ref: jsrsasign x.509 apidoc
Share Improve this question asked Apr 2, 2014 at 12:34 Chris SnowChris Snow 24.6k37 gold badges156 silver badges329 bronze badges3 Answers
Reset to default 6You just need to extract the string from between the "-----BEGIN CERTIFICATE-----" header and "-----END CERTIFICATE----- " footer, base64 decode it and pute SHA1 hash of decoded data.
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
In the version of jsrsasign 10.7.0, You can achieve this by
import { KJUR, pemtohex } from "jsrsasign";
const hex = pemtohex("-----BEGIN CERTIFICATE----- ...... -----END CERTIFICATE----- ");
const fingerprint = KJUR.crypto.Util.hashHex(hex, "sha1")
本文标签: javascriptjsrsasignhow to extract an x509 certificate39s fingerprintStack Overflow
版权声明:本文标题:javascript - jsrsasign - how to extract an x.509 certificate's fingerprint? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742366565a2461405.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论