> From: [email protected] On Behalf Of Anamitra Dutta
Majumdar
> Sent: Thursday, 17 November, 2011 19:44
> There is a requirement to process a pkcs7 bag of certificate chain.
> Is there an OpenSSL API to parse the certificates in a PKCS7
> bag and get
> each of the certificates in the bag as Base64 encoded string.
>
See src/pkcs7.c, which is (already) a commandline utility
to read signeddata or sign&envdata PKCS7 from a file,
extract the certs and/or CRLs, and write them to files.
You can convert each in-memory cert to base64 by i2d_X509_bio
on a BIO_f_base64 over BIO_s_{mem,file,fp} as needed.
Or i2d_X509 to memory and run through EVP_EncodeBlock.
But if you really want PEM, which is base64 with linebreaks
and labels, just use PEM_write_bio_X509 or PEM_write_X509.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]