1. 程式人生 > >openssl檢視證書細節

openssl檢視證書細節

openssl x509部分命令
打印出證書的內容:
openssl x509 -in cert.pem -noout -text
打印出證書的系列號
openssl x509 -in cert.pem -noout -serial
打印出證書的擁有者名字
openssl x509 -in cert.pem -noout -subject
以RFC2253規定的格式打印出證書的擁有者名字
openssl x509 -in cert.pem -noout -subject -nameopt RFC2253
在支援UTF8的終端一行過打印出證書的擁有者名字
openssl x509 -in cert.pem -noout -subject -nameopt oneline -nameopt -escmsb
打印出證書的MD5特徵引數
openssl x509 -in cert.pem -noout -fingerprint
打印出證書的SHA特徵引數
openssl x509 -sha1 -in cert.pem -noout -fingerprint
把PEM格式的證書轉化成DER格式
openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER
把一個證書轉化成CSR
openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem
給一個CSR進行處理,頒發字簽名證書,增加CA擴充套件項
openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca -signkey key.pem -out cacert.pem
給一個CSR簽名,增加使用者證書擴充套件項
openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr -CA cacert.pem -CAkey key.pem -CAcreateserial