在 Ubuntu 上,我无法成功使用 openssl 转换证书。
vagrant@dev:/vagrant/keys$ openssl pkcs7 -print_certs -in a.p7b -out a.cer
unable to load PKCS7 object <blah blah>:PEM
routines:PEM_read_bio:no start line:pem_lib.c:696:Expecting: PKCS7
Run Code Online (Sandbox Code Playgroud)
你以前见过这个错误吗?
qua*_*nta 70
尝试这个:
$ openssl pkcs7 -inform der -in a.p7b -out a.cer
Run Code Online (Sandbox Code Playgroud)
如果它不起作用,请使用 Windows 机器并按照本指南导出。
Pee*_*nde 34
所以结合上面的答案,命令是:
openssl pkcs7 -in cert.p7b -inform DER -print_certs -out cert.pem
经验证可在 Windows 上运行,使用 OpenSSL-Win64
/感谢 Bogdan 发现错误
小智 9
我遵循了指导您更改页眉/页脚行的本指南
-----BEGIN PKCS #7 SIGNED DATA-----
[data]
-----END PKCS #7 SIGNED DATA-----
Run Code Online (Sandbox Code Playgroud)
到
-----BEGIN CERTIFICATE-----
[data]
-----END CERTIFICATE-----
Run Code Online (Sandbox Code Playgroud)
然后运行命令openssl pkcs7 -in foo.modified.crt -print_certs -out foo.certs(foo.modified.crt您将修改后的版本保存到的文件在哪里)。这给了我与其他答案中建议的通过 Windows 证书导出运行相同的结果。
我的情况的快速解决方案(很多文件缺少页眉/页脚):
base64 -d $FILE | openssl pkcs7 -inform DER -print_certs
小智 7
据我所知,以下应该将 pkcs7 证书转换为 pem
openssl pkcs7 -in certificate_file.p7b -print_certs -out cert.pem
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
181434 次 |
| 最近记录: |