简体   繁体   English

如何将.crt文件转换为.pem格式

[英]How to convert .crt file into .pem format

I have two files.One is 5474dd9b93888948.crt and another is gd_bundle-g2-g1.crt. 我有两个文件,一个是5474dd9b93888948.crt,另一个是gd_bundle-g2-g1.crt。 I have to convert this two files into 'PEM encoded X.509 certificate' and 'Unencrypted PEM encoded RSA private key'. 我必须将这两个文件转换为“ PEM编码的X.509证书”和“未加密的PEM编码的RSA私钥”。

can any one tell me openssl commands for it ? 有人可以告诉我openssl命令吗?

File names like foo.crt do not say anything about the file format used. 像foo.crt这样的文件名都没有说明所使用的文件格式。 Look into the files content. 查看文件内容。 If this looks binary they are probable DER encoded and you have to specify the -inform der option with the openssl tools (eg openssl x509 -inform der -in file.crt to convert the certificate to PEM, same for rsa command). 如果这看起来是二进制的,则它们可能是DER编码的,并且您必须使用openssl工具指定-inform der选项(例如, openssl x509 -inform der -in file.crt将证书转换为PEM,与rsa命令相同)。 If they contain text starting with something like -----BEGIN CERTIFICATE----- they are already PEM encoded. 如果它们包含以-----BEGIN CERTIFICATE-----类的内容开头的文本,则说明它们已经过PEM编码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM