« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
| 公告 |
戒除浮躁,读好书,交益友 |
Blog信息 |
blog名称:邢红瑞的blog 日志总数:523 评论数量:1142 留言数量:0 访问次数:9692754 建立时间:2004年12月20日 |

| |
[PKI]常见证书格式和转换  原创空间, 软件技术, 电脑与网络
邢红瑞 发表于 2005/7/22 15:16:48 |
PKCS 全称是 Public-Key Cryptography Standards ,是由 RSA 实验室与其它安全系统开发商为促进公钥密码的发展而制订的一系列标准,PKCS 目前共发布过 15 个标准。 常用的有:PKCS#7 Cryptographic Message Syntax StandardPKCS#10 Certification Request StandardPKCS#12 Personal Information Exchange Syntax Standard
X.509是常见通用的证书格式。所有的证书都符合为Public Key Infrastructure (PKI) 制定的 ITU-T X509 国际标准。
PKCS#7 常用的后缀是: .P7B .P7C .SPCPKCS#12 常用的后缀有: .P12 .PFXX.509 DER 编码(ASCII)的后缀是: .DER .CER .CRTX.509 PAM 编码(Base64)的后缀是: .PEM .CER .CRT.cer/.crt是用于存放证书,它是2进制形式存放的,不含私钥。.pem跟crt/cer的区别是它以Ascii来表示。pfx/p12用于存放个人证书/私钥,他通常包含保护密码,2进制方式p10是证书请求p7r是CA对证书请求的回复,只用于导入p7b以树状展示证书链(certificate chain),同时也支持单个证书,不含私钥。一 用openssl创建CA证书的RSA密钥(PEM格式):openssl genrsa -des3 -out ca.key 1024
二用openssl创建CA证书(PEM格式,假如有效期为一年):openssl req -new -x509 -days 365 -key ca.key -out ca.crt -config openssl.cnfopenssl是可以生成DER格式的CA证书的,最好用IE将PEM格式的CA证书转换成DER格式的CA证书。
三 x509到pfxc:\openssl-1.0.0d\out32\openssl pkcs12 -export -in .\xinhr.pem -inkey .\xinhr.key -out .\xinghr.pfx
四 PEM格式的ca.key转换为Microsoft可以识别的pvk格式。 pvk -in ca.key -out ca.pvk -nocrypt -topvk 验证 openssl pkcs12 -clcerts -nokeys -in cert.p12 -out cert.pem五 pfx到pemc:\openssl-1.0.0d\out32\openssl pkcs12 -in .\xinhr1309851947896.p12 -out .\xinhr.pem -nodes六 从 PFX 格式文件中提取私钥格式文件 (.key) openssl pkcs12 -in mycert.pfx -nocerts -nodes -out mycert.key七 转换 pem 到到 spc openssl crl2pkcs7 -nocrl -certfile venus.pem -outform DER -out venus.spc用 -outform -inform 指定 DER 还是 PAM 格式。例如:openssl x509 -in Cert.pem -inform PEM -out cert.der -outform DER八 PEM 到 PKCS#12 的转换,openssl pkcs12 -export -in Cert.pem -out Cert.p12 -inkey key.pem九 从 CRT format 到 PEMopenssl x509 -in input.crt -out input.der -outform DERopenssl x509 -in input.der -inform DER -out output.pem -outform PEM |
|
|