I am using OpenSSL to construct my own self signed certificate which I have in an X509 structure. I wan't to extract the certificate data out of the X509 structure into a char array.
I am aware of the following macro:
PEM_Write_X509(file *, certificate *)
This will output to a file something like:
-----BEGIN CERTIFICATE------
DATAHERE
-----END CERTIFICATE-----
What I really want is just the "DATAHERE" part directly into a char array. There are a baffling number of macros for doing various things, but I haven't stumbled across one that does what I'm after. Is there anything suitable that I haven't found?
BEGIN and END sections are boundaries for the PEM text. This is standard convention. I believe, removing these sections will make the certificate unusable.