> I want to hard code a certificate in my application

You should create a memory BIO as follows:

        BIO*            bio_p;  /* I/O stream the cert will be read from */
        BUF_MEM*        bm_p;   /* buffer containing data for BIO */

        if ((bio_p = BIO_new(BIO_s_mem())) == NULL)
                error handling...;

        bm_p = (BUF_MEM*)bio_p->ptr;
        bio_p->flags &=
                ~(BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY);
        BUF_MEM_grow(bm_p, length);
        memcpy(bm_p->data, cert_p, length);

where cert_p is the pointer to the certificate and length is the number
of bytes in it. Read the certificate out of it using PEM_read_bio_X509()
for PEM encoded data, or if it's DER, I think the correct method is
d2i_X509_bio(). Then clean up your BIO with BIO_free().

Good luck!

-- 
Clifford Heath                    http://www.osa.com.au/~cjh
Open Software Associates Limited       mailto:[EMAIL PROTECTED]
29 Ringwood Street / PO Box 4414       Phone  +613 9871 1694
Ringwood VIC 3134      AUSTRALIA       Fax    +613 9871 1711
------------------------------------------------------------
Deploy Applications across the net, see http://www.osa.com


+-------------------------------------------------------------------------+
| Administrative requests should be sent to [EMAIL PROTECTED] |
| List service provided by Open Software Associates, http://www.osa.com/  |
+-------------------------------------------------------------------------+

Reply via email to