-->

How do I convert DER Format certificate x509 into

2019-09-21 05:46发布

问题:

How can I convert a DER Format certificate x509 into a human readable format in JavaScript?

回答1:

Javascript does not provide a method to parse certificate fields. You need to use a library like forge. I think you need something like this

var certAsn1 = forge.asn1.fromDer(certDer)
var cert = forge.pki.certificateFromAsn1(certAsn1);
console.log(cert.serialNumber);