SSL证书常用的OPENSSL命令

资源 作者:网络尖刀 2025-06-05 04:07:20 阅读:32

1. 生成CSR命令

以下命令用来生成CSR、Key,以及生成自签发证书

生成CSR - RSA加密算法

openssl req -out itrustssl.cn.csr -new -sha256 -newkey rsa:2048 -nodes -keyout itrustssl.cn.key

生成CSR - ECC加密算法

openssl ecparam -out server.key -name prime256v1 -genkey
openssl req -new -key server.key -out server.csr

生成自签发证书命令

openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt

从密钥生成CSR

openssl req -out CSR.csr -key privateKey.key -new

从证书文件生成CSR

openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key

去除Key密码

openssl rsa -in privateKey.pem -out newPrivateKey.pem

2. OPENSSL相关校验CSR KEY 证书命令

以下命令用来检查、校验Key CSR 以及证书

检查校验CSR包含信息命令

openssl req -text -noout -verify -in CSR.csr

检查校验KEY包含信息命令

openssl rsa -in privateKey.key -check

检查校验SSL证书命令

openssl x509 -in certificate.crt -text -noout

检查校验PKCS#12(后缀为.pfx 或 .p12)格式证书命令

openssl pkcs12 -info -in keyStore.p12


3. OPENSSL的相关排查验证命令

以下命令用来检查、校验Key CSR 以及证书

检查证书、CSR、Key是否匹配命令

openssl x509 -noout -modulus -in certificate.crt | openssl md5
openssl rsa -noout -modulus -in privateKey.key | openssl md5
openssl req -noout -modulus -in CSR.csr | openssl md5

检查已安装SSL证书网站的证书信息命令

openssl s_client -connect www.baidu.com:443


4. PEM转换使用的OPENSSL命令

转换 PEM 到 DER

openssl x509 -outform der -in certificate.pem -out certificate.der

转换 PEM 到 P7B

openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer

转换 PEM 到 PFX

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

转换 PEM 到 JKS

点击查看 PEM转tomcat使用的jks命令


5. DER转换使用的OPENSSL命令

转换 DER 到 PEM

openssl x509 -inform der -in certificate.cer -out certificate.pem


6. P7B转换使用的OPENSSL命令

转换 P7B 到 PEM

openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

转换 P7B 到 PFX

openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer
openssl pkcs12 -export -in certificate.cer -inkey privateKey.key -out certificate.pfx -certfile CACert.cer


7. PFX转换使用的OPENSSL命令

转换 PFX 到 PEM

openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes

延伸阅读
  • 网最低价SSL证书iTrustSSL的三大核心竞争力

    当前网络安全形势日益严峻,全球网站HTTPS加密覆盖率已超过90%。传统SSL证书动辄上千元的年费让中小企业望而却步,而免费证书又存在兼容性差、有效期短等痛点。iTrustSSL通过技术创新和规模化运

  • SSL证书和域名不匹配如何解决?

    SSL证书域名不匹配问题是一个常见的网络安全问题,通常会导致浏览器显示安全警告,影响用户的信任度和网站的正常使用。本文将详细探讨SSL证书域名不匹配的原因,并提供一系列解决方案,帮助网站管理员快速有效

  • 密钥交换机制:DH与ECDH在SSL证书中的关键作用

    DH密钥交换算法和其基于椭圆曲线的变种ECDH,因其在提供安全性和效率方面的优势,被广泛应用于现代SSL/TLS协议中。本文将深入探讨DH和ECDH算法的基本原理,以及它们在SSL证书中的具体应用和关

在线申请SSL证书行业最低 =>立即申请

[广告]赞助链接:

关注数据与安全,洞悉企业级服务市场:https://www.ijiandao.com/
让资讯触达的更精准有趣:https://www.0xu.cn/

#
公众号 关注KnowSafe微信公众号
随时掌握互联网精彩
赞助链接
在线咨询