Apache SSL 使用 openssl 将 itermediateCA.cer 转换为 crt

cod*_*ree 5 apache ssl openssl

尝试将 IntermidiateCA.cer 转换为 Apache 的 crt 格式,但我做不到。我使用下面的命令:

openssl x509 -inform DER -in IntermediateCA.cer -out IntermediateCA.crt
Run Code Online (Sandbox Code Playgroud)

这是我在下面遇到的错误

unable to load certificate
4276141236:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong 
tag:tasn_dec.c:1198:
 4276141236:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested 
asn1 error:tasn_dec.c:372:Type=X509
Run Code Online (Sandbox Code Playgroud)

请注意服务器是solaris 5.10

小智 6

有两种常见的证书编码类型。如果您可以读取“----BEGIN CERTIFICATE----”,那么它是 PEM 编码的。如果不是,则采用 DER(二进制)编码。尝试使用指定错误编码的 openssl x509 命令进行转换将产生错误。

如果证书文件是 DER 编码(二进制)

openssl x509 -inform DER -in certificate.cer -out certificate.crt

如果证书是 PEM 编码的(人类可读)

openssl x509 -inform PEM -in certificate.cer -out certificate.crt