Find yourself a base64 encoding/decoding library. That's all you need. Here's the pseudo code:
DER = base64-decode(PEM); PEM = base64-encode(DER); Well, and you need to add/remove the "----- BEGIN CERTIFICATE -----" lines. Good luck! yours, Julius On Wed, Apr 9, 2008 at 7:29 AM, geragray <[EMAIL PROTECTED]> wrote: > > I need it for a set of functions that would convert PEM certificates to DER > and vise versa. I found openssl command line tool: > x509 –in input.crt –inform PEM –out output.crt –outform DER > and traced it's code: > > It is done by creating X509 object from a file and then converting it to the > requred format: > > if (outformat == FORMAT_ASN1) > i=i2d_X509_bio(out,x); > else if (outformat == FORMAT_PEM) > { > if (trustout) i=PEM_write_bio_X509_AUX(out,x); > else i=PEM_write_bio_X509(out,x); > } > > The problem is that i can't use files in my project, all i have is byte > pointers to the memory where certificates is stored. Did anybody have such > problem already? Thanks for any advice. > -- > View this message in context: > http://www.nabble.com/Functions-for-converting-PEM-certificates-to-DER-tp16586199p16586199.html > Sent from the OpenSSL - User mailing list archive at Nabble.com. > > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager [EMAIL PROTECTED] > -- yours, Julius Davies 250-592-2284 (Home) 250-893-4579 (Mobile) http://juliusdavies.ca/ ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]