security - 如何检查我拥有的证书文件是否为 .pem 格式?

标签 security certificate

我有一个根证书文件,但我不知道它是否为 .pem 格式。如何检查它是否为 .pem 格式?

最佳答案

DER vs. CRT vs. CER vs. PEM Certificates and How To Convert Them

引用自支持页面:

View
====

Even though PEM encoded certificates are ASCII they are not human
readable.  Here are some commands that will let you output the
contents of a certificate in human readable form;

View PEM encoded certificate
----------------------------

Use the command that has the extension of your certificate replacing
cert.xxx with the name of your certificate

openssl x509 -in cert.pem -text -noout
openssl x509 -in cert.cer -text -noout
openssl x509 -in cert.crt -text -noout

If you get the folowing error it means that you are trying to view a DER encoded certifciate and need to use the commands in the “View DER encoded certificate 
below”

unable to load certificate
12626:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:647:Expecting: TRUSTED CERTIFICATE View DER encoded Certificate


View DER encoded Certificate
----------------------------

openssl x509 -in certificate.der -inform der -text -noout

If you get the following error it means that you are trying to view a PEM encoded certificate with a command meant for DER encoded certs. Use a command in the “View PEM encoded certificate above

unable to load certificate
13978:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1306:
13978:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:380:Type=X509

关于security - 如何检查我拥有的证书文件是否为 .pem 格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5215771/

相关文章:

c# - windows服务器证书导出导入问题

ubuntu - 如何在ubuntu上添加证书?

certificate - 带有存储在本地计算机中的证书的签名工具

android - https 的自签名证书

javascript - 通过 HTTPS 在 AJAX 调用中返回 HTML 内容的风险

windows - 限制访问开发网站的最佳方法是什么?

javascript - Javascript 的 XSS 安全 html 解码

c# - 有没有办法以编程方式设置 "UserChoice"注册表项以接管文件类型关联?

ssl - 嵌入式网络服务器和证书