praveens wrote:
I want to know the openssl APIs to convert a certificate from .pem to .der
format.
I know about the openssl command which does the same. But Can you tell me
how to do it in a Cprogram using openssl or any other method
Hi,

load your x509 file using

loaded = PEM_read_X509(f, NULL, NULL, NULL);   // load in pem
with f = fopen( fileName,"rb");
and loaded a X509*

save it :
BIO *out=NULL;
   if ((out=BIO_new(BIO_s_file())) == NULL)
       return -1;
if(BIO_write_filename(out, filename2) <= 0)
       return -1;
   if (! i2d_X509_bio(out, loaded)) // save it in der.
           return -1;
   return 0; // success

filename is the file's name of pem certificate, filename2 is the file's name for der certificate.

(joke)You can also use syscall (/joke)
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to