如何从SSL证书创建PEM文件?
这些是我有可用的文件:
.crt server.csr server.key
如何从SSL证书创建PEM文件?
这些是我有可用的文件:
.crt server.csr server.key
当前回答
此外,如果你不希望它要求一个密码短语,那么需要运行以下命令:
openssl rsa -in server.key -out server.key
其他回答
这是创建.pem文件的最佳选项
openssl pkcs12 -in MyPushApp.p12 -out MyPushApp.pem -nodes -clcerts
在Windows上,你可以使用certutil工具:
certutil -encode server.crt cert.pem
certutil -encode server.key key.pem
你可以在PowerShell中将两个文件合并为一个文件,如下所示:
Get-Content cert.pem, key.pem | Set-Content cert-and-key.pem
在CMD中,像这样:
copy cert.pem+key.pem cert-and-key.pem /b
通过appleId从临时门户下载证书, 从密钥链导出证书并给出名称(Certificates.p12), 打开终端和goto文件夹,你保存上述证书。p12文件, 执行以下命令: a) openssl pkcs12 -in证书。p12 -out CertificateName. p12pem节点, b) openssl pkcs12 -in证书。P12 -out pushcert。Pem -nodes -clcerts 您的。pem文件准备“pushcert.pem”。
我观察到的是:如果您使用openssl来生成证书,它会捕获crt文件中的文本部分和base64证书部分。严格的pem格式表示(wiki定义)文件应该以BEGIN和end开始和结束。
.pem -(隐私增强邮件)Base64编码DER证书, 附上证书”——开始——“和”——之间结束 证书——”
因此,对于一些库(我在java中遇到过这种情况),期望严格的pem格式,生成的crt会作为“无效的pem格式”验证失败。
即使您使用BEGIN/END CERTIFICATE复制或grep这些行,并将其粘贴到cert.pem文件中,它也应该可以工作。
以下是我所做的,不是很干净,但对我来说很有用,基本上它从BEGIN行开始过滤文本:
grep -A 1000 BEGIN cert.crt > cert.pem .pem
我尝试上传GoDaddy证书到AWS失败了几次,但最后还是很简单。不需要将任何东西转换为.pem。你只需要确保在chain参数中包含GoDaddy捆绑包证书。
aws iam upload-server-certificate
--server-certificate-name mycert
--certificate-body file://try2/40271b1b25236fd1.crt
--private-key file://server.key
--path /cloudfront/production/
--certificate-chain file://try2/gdig2_bundle.crt
并删除你以前失败的上传你可以做
aws iam delete-server-certificate --server-certificate-name mypreviouscert