Is there any openssl api function to convert a PKCS7 file to PEM. I can convert the PKCS12 file to PEM using the PKCS12_parse () function, which returns a key and certificate with a password. There is no similar function for pkcs7.
In my pkcs7 input there is only a binary certificate. I can do the conversion using the command
openssl pkcs7 -inform DER -in input.p7b -printcerts -text
How to do this in a C program? I can read it in a PKCS7 structure like this
FILE* fp;
if (!(fp = fopen("ca.p7b", "rb"))) {
fprintf(stderr, "Error reading input pkcs7 file\n" );
exit(1);
}
PKCS7 *p7;
p7 = d2i_PKCS7_fp(cafp, NULL);
source
share