Is a X509 certificate in DER format ASN1 encoded?

被刻印的时光 ゝ 提交于 2019-12-20 06:12:24

问题


I'm using OpenSSl to encrypt and decrypt files based on CMS/SMIME. Normally I load certificates with rcert = PEM_read_bio_X509(tbio, NULL, 0, NULL); but this is only for PEM formatted files I guess. I haven't found any der.h header or something similar.

So is there a way in OpenSSL to load DER formatted certificates? I've found the load function for ASN1 format which uses OpenSSL intern.

if  (format == FORMAT_ASN1)
        x=d2i_X509_bio(cert,NULL);

But can that be used for DER which is binary?


回答1:


DER is indeed encoded using ASN.1, and the d2i_*() family of functions is the way to load a DER file.



来源:https://stackoverflow.com/questions/9499670/is-a-x509-certificate-in-der-format-asn1-encoded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!