【发布时间】:2021-09-19 20:46:17
【问题描述】:
我试图查看 tbsCerticate 的内容。
这就是我所做的:
- 从网站 (baidu.com) 以 der 二进制格式下载证书。
- 使用
openssl x509 -in bd.cer -inform cer -text -noout >> bd.cer.noout.txt翻译成文本。现在我可以看到证书中的内容 -
openssl asn1parse -inform der -in bd.cer > bd.cer.asn1解析证书。根据rfc5280,第二行是tbsCertificate内容,即4:d=1 hl=4 l=2326 cons: SEQUENCE。 -
dd if=bd.cer of=bd.cer.tbsCertificate skip=4 bs=1 count=2330转储字节。 -
openssl x509 -in bd.cer.tbsCertificate -inform der -text -noout >> bd.cer.tbs.txt现在想把bd.cer.tbsCertificate解析成x509格式看,但是失败了。
unable to load certificate
140421447947392:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag:../crypto/asn1/tasn_dec.c:1149:
140421447947392:error:0D07803A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:309:Type=X509_CINF
140421447947392:error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:646:Field=cert_info, Type=X509
我想知道为什么我不能像bd.cer 一样将bd.cer.tbsCertificate 翻译成x509。我错过了什么吗?从报错看来是结构不对。
如果我想查看 txt 中的 tbsCertificate 以了解具体加密的内容,我应该怎么做。感谢您的帮助!
【问题讨论】:
标签: certificate x509 asn.1