将 .crt 文件转换为 .pem 文件时出错
Getting an error while converting .crt to .pem file
我在尝试将 .crt 文件转换为 .pem 时出现以下错误
命令:
openssl x509 -inform der -in ABC.crt -out ABC.pem
错误:
unable to load certificate
140314118051744:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1199:
140314118051744:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:374:Type=X509
ABC.crt
MIIDYTCCAkmgAwIBAgIGAV0znSRkMA0GCSqGSIb3DQEBCwUAMFkxEzARBgoJkiaJk/IsZAEZFgNjb20xFjAUBgoJkiaJk/IsZAEZFgZvcmFjbGUxFTATBgoJkiaJk/IsZAEZFgVjbG91ZDETMBEGA1UEAxMKQ2xvdWQ5Q0EtMjAeFw0xNzA3MTEyMTQ1MjJaFw0yNzA3MTEyMTQ1MjJaMFYxEzARBgNVBAMTCnNzbERvbWFpbnMxDzANBgNVBAMTBkNsb3VkOTEuMCwGA1UEAxMlaWRjcy05Y2I1NzYwM2QwYjc0Mjg0ODFiNDQ0NTgzYWZlNzAxNDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANuTVdug3dS1RjR5ydP90IAUWkGcx/iwQCsinGPA8k1dtHAs4coZpCM0z4XDEu/zbVPshVx7Og2euNdOFFelAPVMz/C4tm8LMk5ZROY4u8VUao7O4V2uMiJlROPEY9FbZpk5a7lh1BsnxPlH6qfm4LZtnsjmWo12OzQ72RQRElsxaqbyAGPX/A6IoFvNVhNvuReqHl7boksFwXrdBzq9uJ9VF0YN+3JuMOgMersTcW0SLARepXXhaXe45MlhXYx1ZbPj/3sHb4mo6iRDK9oTha2dInGQ+9fHKrQ/HgDFjRojqwYjHtBrKcHz2DCHdf9Em4oJEBI7lCQ4gKHIp40RuW0CAwEAAaMyMDAwHQYDVR0OBBYEFFwscxks8Q/z+4FUAi2yryyXi6/vMA8GA1UdDwEB/wQFAwMH2AAwDQYJKoZIhvcNAQELB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jNTAzMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFMsXQZBqmxc1LqYNCYwt9OCIMZGRMA0GCSqGSIb3DQEBCwUAA4IBAQC3IFrmt4eQ2Ggx6cp4I9F57BuKBRjH4cbebFM+gL6mvaUsOhtzzZHuR05a5BQYW1CFU7CG2cGEjeSeBqWLcKbq5iXC44gdMcFWH7R5GApNJO3CNI8QZJdbzLWDF0UzPKXxcHwF8niduJuyFwfe/pcW4aWzFdOLKAlIv1iXeungmdhZLg37yh3Zt7WnTAtQFgM0cvxkZlRcreQVisvLtZvTd+wVAUNo57ws/y1cPIBiWwxrvcFDv3+U0I+y2eVqbtmV2nWKeQ1aisBLdQydsuatQM8+C4nFC+BJvfdkYY+6+JNeTc6GCnTpQo3/nkDHH08PGR5Rs+NAdvlshL1GgHbU
我已经检查了提供的其他解决方案,但找不到答案。
有人可以帮忙吗?
如以下解决方案中所述,我尝试拆分这两个证书:
File1.crt
MIIDYTCCAkmgAwIBAgIGAV0znSRkMA0GCSqGSIb3DQEBCwUAMFkxEzARBgoJkiaJk/IsZAEZFgNjb20xFjAUBgoJkiaJk/IsZAEZFgZvcmFjbGUxFTATBgoJkiaJk/IsZAEZFgVjbG91ZDETMBEGA1UEAxMKQ2xvdWQ5Q0EtMjAeFw0xNzA3MTEyMTQ1MjJaFw0yNzA3MTEyMTQ1MjJaMFYxEzARBgNVBAMTCnNzbERvbWFpbnMxDzANBgNVBAMTBkNsb3VkOTEuMCwGA1UEAxMlaWRjcy05Y2I1NzYwM2QwYjc0Mjg0ODFiNDQ0NTgzYWZlNzAxNDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANuTVdug3dS1RjR5ydP90IAUWkGcx/iwQCsinGPA8k1dtHAs4coZpCM0z4XDEu/zbVPshVx7Og2euNdOFFelAPVMz/C4tm8LMk5ZROY4u8VUao7O4V2uMiJlROPEY9FbZpk5a7lh1BsnxPlH6qfm4LZtnsjmWo12OzQ72RQRElsxaq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6EHUzqYQPD8r0OcP+fk2TqR2v2PvPmt6KKXicFPUIoDUnznmdKdgCP+TJE8QjKZgJenR1Y6Q6JW6I1G3bo+auSaL5sITLV8JnN/kd1XWejFEMpovMp8WdBid2wi9abDoygndI9YPfM64/vG1qF1vb8TgyIRRqRRF6DvFa3O6TIjhp9UU8zVfauYmn9BkRt2pylJ2wntfg9FYsl6ZSydltMHQcuHETnxLoJbUwRYv4ah1ca2o0EYZWlGy2EtyX7Qi/ECAKMWSlAgMBAAGjNTAzMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFMsXQZBqmxc1LqYNCYwt9OCIMZGRMA0GCSqGSIb3DQEBCwUAA4IBAQC3IFrmt4eQ2Ggx6cp4I9F57BuKBRjH4cbebFM+gL6mvaUsOhtzzZHuR05a5BQYW1CFU7CG2cGEjeSeBqWLcKbq5iXC44gdMcFWH7R5GApNJO3CNI8QZJdbzLWDF0UzPKXxcHwF8niduJuyFwfe/pcW4aWzFdOLKAlIv1iXeungmdhZLg37yh3Zt7WnTAtQFgM0cvxkZlRcreQVisvLtZvTd+wVAUNo57ws/y1cPIBiWwxrvcFDv3+U0I+y2eVqbtmV2nWKeQ1aisBLdQydsuatQM8+C4nFC+BJvfdkYY+6+JNeTc6GCnTpQo3/nkDHH08PGR5Rs+NAdvlshL1GgHbU
并再次尝试将它们分别转换为 .pem 文件,但我遇到了同样的错误
ABC.crt
内容是无效的证书文件。
事实上,该文件包含两个证书。我发现里面有一个 ","
分隔符,文件包含两个证书。文件格式错误。
如果您删除此分隔符(拆分)并将分隔符前后的 base64 字符串放入单独的文件中,您将获得两个 base64 编码的普通 X.509 证书。
如果您包装这些 Base64 字符串,您将获得格式完美的 PEM 文件,您甚至不需要使用 OpenSSL。
一个:
-----BEGIN CERTIFICATE-----
MIIDYTCCAkmgAwIBAgIGAV0znSRkMA0GCSqGSIb3DQEBCwUAMFkxEzARBgoJkiaJ
k/IsZAEZFgNjb20xFjAUBgoJkiaJk/IsZAE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mdhZLg37yh3Zt7WnTAtQFgM0
cvxkZlRcreQVisvLtZvTd+wVAUNo57ws/y1cPIBiWwxrvcFDv3+U0I+y2eVqbtmV
2nWKeQ1aisBLdQydsuatQM8+C4nFC+BJvfdkYY+6+JNeTc6GCnTpQo3/nkDHH08P
GR5Rs+NAdvlshL1GgHbU
-----END CERTIFICATE-----
我在尝试将 .crt 文件转换为 .pem 时出现以下错误
命令:
openssl x509 -inform der -in ABC.crt -out ABC.pem
错误:
unable to load certificate
140314118051744:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1199:
140314118051744:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:374:Type=X509
ABC.crt
MIIDYTCCAkmgAwIBAgIGAV0znSRkMA0GCSqGSIb3DQEBCwUAMFkxEzARBgoJkiaJk/IsZAEZFgNjb20xFjAUBgoJkiaJk/IsZAEZFgZvcmFjbGUxFTATBgoJkiaJk/IsZAEZFgVjbG91ZDETMBEGA1UEAxMKQ2xvdWQ5Q0EtMjAeFw0xNzA3MTEyMTQ1MjJaFw0yNzA3MTEyMTQ1MjJaMFYxEzARBgNVBAMTCnNzbERvbWFpbnMxDzANBgNVBAMTBkNsb3VkOTEuMCwGA1UEAxMlaWRjcy05Y2I1NzYwM2QwYjc0Mjg0ODFiNDQ0NTgzYWZlNzAxNDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANuTVdug3dS1RjR5ydP90IAUWkGcx/iwQCsinGPA8k1dtHAs4coZpCM0z4XDEu/zbVPshVx7Og2euNdOFFelAPVMz/C4tm8LMk5ZROY4u8VUao7O4V2uMiJlROPEY9FbZpk5a7lh1BsnxPlH6qfm4LZtnsjmWo12OzQ72RQRElsxaqbyAGPX/A6IoFvNVhNvuReqHl7boksFwXrdBzq9uJ9VF0YN+3JuMOgMersTcW0SLARepXXhaXe45MlhXYx1ZbPj/3sHb4mo6iRDK9oTha2dInGQ+9fHK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2wi9abDoygndI9YPfM64/vG1qF1vb8TgyIRRqRRF6DvFa3O6TIjhp9UU8zVfauYmn9BkRt2pylJ2wntfg9FYsl6ZSydltMHQcuHETnxLoJbUwRYv4ah1ca2o0EYZWlGy2EtyX7Qi/ECAKMWSlAgMBAAGjNTAzMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFMsXQZBqmxc1LqYNCYwt9OCIMZGRMA0GCSqGSIb3DQEBCwUAA4IBAQC3IFrmt4eQ2Ggx6cp4I9F57BuKBRjH4cbebFM+gL6mvaUsOhtzzZHuR05a5BQYW1CFU7CG2cGEjeSeBqWLcKbq5iXC44gdMcFWH7R5GApNJO3CNI8QZJdbzLWDF0UzPKXxcHwF8niduJuyFwfe/pcW4aWzFdOLKAlIv1iXeungmdhZLg37yh3Zt7WnTAtQFgM0cvxkZlRcreQVisvLtZvTd+wVAUNo57ws/y1cPIBiWwxrvcFDv3+U0I+y2eVqbtmV2nWKeQ1aisBLdQydsuatQM8+C4nFC+BJvfdkYY+6+JNeTc6GCnTpQo3/nkDHH08PGR5Rs+NAdvlshL1GgHbU
我已经检查了提供的其他解决方案,但找不到答案。 有人可以帮忙吗?
如以下解决方案中所述,我尝试拆分这两个证书:
File1.crt
MIIDYTCCAkmgAwIBAgIGAV0znSRkMA0GCSqGSIb3DQEBCwUAMFkxEzARBgoJkiaJk/IsZAEZFgNjb20xFjAUBgoJkiaJk/IsZAEZFgZvcmFjbGUxFTATBgoJkiaJk/IsZAEZFgVjbG91ZDETMBEGA1UEAxMKQ2xvdWQ5Q0EtMjAeFw0xNzA3MTEyMTQ1MjJaFw0yNzA3MTEyMTQ1MjJaMFYxEzARBgNVBAMTCnNzbERvbWFpbnMxDzANBgNVBAMTBkNsb3VkOTEuMCwGA1UEAxMlaWRjcy05Y2I1NzYwM2QwYjc0Mjg0ODFiNDQ0NTgzYWZlNzAxNDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANuTVdug3dS1RjR5ydP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EzARBgNVBAMTCkNsb3VkOUNBLTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDWkN6qRNHvItlZ+yQ2RjJ8kGQGRHjP6F+BNYrsKM0okDmuNDZyGoNvbhJD0mEZUDiKokaJJ0+pTSl6EHUzqYQPD8r0OcP+fk2TqR2v2PvPmt6KKXicFPUIoDUnznmdKdgCP+TJE8QjKZgJenR1Y6Q6JW6I1G3bo+auSaL5sITLV8JnN/kd1XWejFEMpovMp8WdBid2wi9abDoygndI9YPfM64/vG1qF1vb8TgyIRRqRRF6DvFa3O6TIjhp9UU8zVfauYmn9BkRt2pylJ2wntfg9FYsl6ZSydltMHQcuHETnxLoJbUwRYv4ah1ca2o0EYZWlGy2EtyX7Qi/ECAKMWSlAgMBAAGjNTAzMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFMsXQZBqmxc1LqYNCYwt9OCIMZGRMA0GCSqGSIb3DQEBCwUAA4IBAQC3IFrmt4eQ2Ggx6cp4I9F57BuKBRjH4cbebFM+gL6mvaUsOhtzzZHuR05a5BQYW1CFU7CG2cGEjeSeBqWLcKbq5iXC44gdMcFWH7R5GApNJO3CNI8QZJdbzLWDF0UzPKXxcHwF8niduJuyFwfe/pcW4aWzFdOLKAlIv1iXeungmdhZLg37yh3Zt7WnTAtQFgM0cvxkZlRcreQVisvLtZvTd+wVAUNo57ws/y1cPIBiWwxrvcFDv3+U0I+y2eVqbtmV2nWKeQ1aisBLdQydsuatQM8+C4nFC+BJvfdkYY+6+JNeTc6GCnTpQo3/nkDHH08PGR5Rs+NAdvlshL1GgHbU
并再次尝试将它们分别转换为 .pem 文件,但我遇到了同样的错误
ABC.crt
内容是无效的证书文件。
事实上,该文件包含两个证书。我发现里面有一个 ","
分隔符,文件包含两个证书。文件格式错误。
如果您删除此分隔符(拆分)并将分隔符前后的 base64 字符串放入单独的文件中,您将获得两个 base64 编码的普通 X.509 证书。
如果您包装这些 Base64 字符串,您将获得格式完美的 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