
SSL證書常用的OPENSSL命令
聲明:該文章由作者(徐愛麗)發(fā)表,轉(zhuǎn)載此文章須經(jīng)作者同意并請(qǐng)附上出處(0XUCN)及本頁鏈接。。
1. 生成CSR命令
以下命令用來生成CSR、Key,以及生成自簽發(fā)證書
生成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
生成自簽發(fā)證書命令
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相關(guān)校驗(yàn)CSR KEY 證書命令
以下命令用來檢查、校驗(yàn)Key CSR 以及證書
檢查校驗(yàn)CSR包含信息命令
openssl req -text -noout -verify -in CSR.csr
檢查校驗(yàn)KEY包含信息命令
openssl rsa -in privateKey.key -check
檢查校驗(yàn)SSL證書命令
openssl x509 -in certificate.crt -text -noout
檢查校驗(yàn)PKCS#12(后綴為.pfx 或 .p12)格式證書命令
openssl pkcs12 -info -in keyStore.p12
3. OPENSSL的相關(guān)排查驗(yàn)證命令
以下命令用來檢查、校驗(yàn)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證書網(wǎng)站的證書信息命令
openssl s_client -connect www.baidu.com:443
4. PEM轉(zhuǎn)換使用的OPENSSL命令
轉(zhuǎn)換 PEM 到 DER
openssl x509 -outform der -in certificate.pem -out certificate.der
轉(zhuǎn)換 PEM 到 P7B
openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer
轉(zhuǎn)換 PEM 到 PFX
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt
轉(zhuǎn)換 PEM 到 JKS
點(diǎn)擊查看 PEM轉(zhuǎn)tomcat使用的jks命令
5. DER轉(zhuǎn)換使用的OPENSSL命令
轉(zhuǎn)換 DER 到 PEM
openssl x509 -inform der -in certificate.cer -out certificate.pem
6. P7B轉(zhuǎn)換使用的OPENSSL命令
轉(zhuǎn)換 P7B 到 PEM
openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer
轉(zhuǎn)換 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轉(zhuǎn)換使用的OPENSSL命令
轉(zhuǎn)換 PFX 到 PEM
openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes
[超站]友情鏈接:
四季很好,只要有你,文娛排行榜:https://www.yaopaiming.com/
關(guān)注數(shù)據(jù)與安全,洞悉企業(yè)級(jí)服務(wù)市場:https://www.ijiandao.com/
- 1 豐收時(shí)節(jié)感悟總書記的“三農(nóng)”情懷 7904059
- 2 深圳機(jī)場飛機(jī)被“五花大綁”防臺(tái)風(fēng) 7808158
- 3 疑追風(fēng)觀浪 香港一對(duì)母子被卷入海 7712647
- 4 盤點(diǎn)新疆的全國之“最” 7616071
- 5 驢肉價(jià)格上漲 中國正面臨缺驢問題 7519937
- 6 用一條毛巾避免大窗玻璃離家出走 7427771
- 7 護(hù)網(wǎng):社交賬號(hào)不受控制?木馬在作祟 7332351
- 8 鴻蒙智行秋季新品發(fā)布會(huì) 7235372
- 9 “晚1秒就撞 我肯定不慣著他” 7135906
- 10 中國每年吃掉約70億只白羽肉雞 7048841