[openssl-dev] Write PEM to char*
Viktor Dukhovni
openssl-users at dukhovni.org
Sun Mar 15 05:51:36 UTC 2015
On Sun, Mar 15, 2015 at 10:16:25AM +0530, dE wrote:
> I was wondering if there are ways by which you can get a PEM encoded
> certificate stored into a char* from a X509 structure.
>
> I got a lot of ways to write it to FILE, but nothing appears to return a
> char*.
Use a memory BIO and PEM_write_bio_X509().
In memory the DER representation is generally more useful than PEM.
The only plausible reason that comes to mind for using PEM in memory
is for a UI that allows users to copy/paste PEM format certificates.
Do you really need PEM? Or might i2d_X509() be a better interface
for your real needs (serializing X509 data).
--
Viktor.
More information about the openssl-dev
mailing list