Hi all,

I have some openssl code that creates a certificate based on a SPKAC, and then 
attempts to send the certificate back to the browser. This works fine in 
Firefox, but doesn't working in Safari, or at least it does work, except that 
Safari doesn't recognise the MIME type of the certificate, and tries to 
"download" the certificate and save it to the downloads folder instead.

I am struggling with the lack of documentation on this stuff, what is the 
expected certificate format when delivering a certificate as 
application/x-x509-user-cert?

Most specifically, is this code correct:

        BIO *b = BIO_new(BIO_s_mem());
        char buf[LEN];
        int len;

        set_content_type(r, "application/x-x509-user-cert");
        i2d_X509_bio(b, cert);

        while ((len = BIO_gets(b, buf, sizeof(buf))) > 0) {
            // write buf
        }

        BIO_free(b);

Or should I be using something other than i2d_X509_bio()?

Regards,
Graham
--

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to