Hello,
> Is there a way that i can get an X509 cert from an array holding a cert in
> DER format.
> So my question is How do i read a DER using a BIO cause the cert in is
> memory and not in a file (for file i know there are d2i functions that
> return X509).
You may use something like that:
/**
* Create X509 certificate object from buf in DER format.
*
* @param cert return X509 object with created certificate
* @param buf buffer with certificate in DER format
* @param len size of buffer
* @return 0 on success, -1 on error
*/
int tls_der2cert(X509 ** cert, char *buf, int len)
{
BIO *mem;
if ((mem = BIO_new_mem_buf(buf, len)) == NULL) {
goto err;
}
*cert = d2i_X509_bio(mem, NULL);
BIO_free(mem);
if (*cert == NULL) {
goto err;
}
return (0);
err:
return (-1);
}
Best regards,
--
Marek Marcola <[EMAIL PROTECTED]>
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]