0
votes

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

1 Answers

2
votes

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