node.js - 如何检查/获取 ssl 证书到期日期

标签 node.js ssl tls1.2

我有 Let's encrypt 证书包。它包括私钥和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/

相关文章:

ssl - 具有本地 IP 的设备的自签名证书

c - 客户端连接时没有服务器证书和 "no shared cipher"

node.js - 在重新启动之间保存 readline CLI 命令历史记录

javascript - NodeJS + 套接字.io : simple Client/Server example not working

postgresql - Heroku - 禁用 Postgresql SSL?

git - Jenkins 无法访问本地 github 存储库

javascript - Object.prototype 在 Node 中返回空对象

javascript - Index.html 到 EJS 文件错误

qt - QNetwork TLS 可移植

postgresql - Azure PostgreSQL 服务器上的 TLSv1.2