公私钥匹配

验证证书与私钥、CSR与私钥是否配对,确保您的SSL配置安全可靠。

检查证书和私钥是否匹配

openssl x509 -noout -modulus -in cert.pem | openssl md5
openssl rsa -noout -modulus -in private.key | openssl md5
openssl pkey -noout -modulus -in private.key | openssl md5
  • 两条命令的输出 md5 值一致,则说明证书和私钥是匹配的
  • 对于 PKCS#8 格式的私钥,使用 openssl pkey 命令,加密的私钥会提示输入密码

检查 CSR 和私钥是否匹配

openssl req -noout -modulus -in cert.csr | openssl md5
openssl rsa -noout -modulus -in private.key | openssl md5

注意事项:

如果使用 JKS 格式,匹配验证需要先导出证书和私钥,再用上面的方法检查

声明:

1、MySSL不会存储和收集用户私钥信息。

2、建议商业用户使用离线工具生成和处理私钥,如 OpenSSL、XCA、KeyManager 本地加密存储。