我有让我们加密证书捆绑包。它包括私钥和certificate.crt

使用node.js和node-forge(不是openssl),如何获得certificate.crt的到期日期?

最佳答案

您可以使用x509模块

var crt_pem = "<certificate in pem format which is content of your certificate.crt>";
const x509 = require('x509');
var crt_obj = x509.parseCert(crt_pem);
console.log(crt_obj.notBefore);
console.log(crt_obj.notAfter);

关于node.js-如何检查/获取ssl证书的到期日期,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56771030/

10-11 03:55