openssl dgst -verify pub.pem -sha256 -signature sign.txt file.txt 經過公鑰pub.pem驗證簽名文件sign.txt和file.txtnode
openssl x509 -in new.crt -pubkey -noout > pubkey.pem 從證書new.crt提取公鑰文件pubkey.pemlinux
openssl base64 -in test.base64 -d -out text.bin 將base64編碼文件test.base64轉爲二進制文件tetx.bin 須要手動在test.base64後添加換行符編碼
openssl dgst -binary -sha256 -out hash.bin test.tar 計算test.tar包的hash值 (二進制格式)
openssl base64 -in hash.bin -out hash.base64 計算base64編碼.net
對csr文件進行簽名:orm
openssl smime -sign -binary -signer certificat.pem -inkey key.pem -in testCSRfile_to_sign.pem -out testCSRfile_smime.signed -nodetachserver
openssl smime -verify -noverify -in testCSRfile_smime.signed -pk7out -out testCSRfile_P7.signedssl
openssl pkcs7 -in testCSRfile_P7.signed -out testCSRfile_P7_DER.signed -outform deropenssl
mv testCSRfile_P7_DER.signed PKCS10_testCSRfile.datahash
openssl經常使用命令base64
http://man.linuxde.net/openssl
ECC證書請求文件
openssl ecparam -name prime256v1 -genkey -out server-ecc.key 生成密鑰
openssl req -new -key server-ecc.key -out server.csr 生成csr請求文件
從p7b格式證書鏈提取證書
openssl pkcs7 -inform der -in consol_p7_MP_ECC_256_18.p7b -out MP_ECC.p7b
openssl pkcs7 -print_certs -in MP_ECC.p7b -out MP_ECC.cer
驗證證書鏈
openssl verify -CAfile MP_RSA_2048_chain.cer -untrusted rsa_sec.cer submp.cer
MP_RSA_2048_chain二級證書鏈,有根證書和二級證書
rsa_sec.cer二級證書
submp.cer葉子證書