I have a PEM-format server certificate that I need to convert to a binary
structure as defined in section 7.4.2. (Server Certificate) of RFC5246
(TLS v1.2).


        Server certificate (in PEM format), residing as a
            text file in the filesystem
                            |
                            |
                            V
      Load into buffer in memory with structure as defined in RFC5246:

                 opaque ASN.1Cert<1..2^24-1>;

                 struct {
                   ASN.1Cert certificate_list<0..2^24-1>;
                 } Certificate;

                certificate_list



Also, I will need to do the reverse: converting a binary buffer in memory
(with the structure above) into a PEM-format server certificate.

My question is: are there OpenSSL routines that do this?  I have looked at

     X509 *PEM_read_bio_X509(BIO *bp, X509 **x,
                             pem_password_cb *cb, void *u);

but it is not clear to me how I should handle (BIO* bp).  If this function
indeed does what I need, how would I convert my memory buffer to a BIO, and
vice versa?







______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to