I have a PKCS7 signature which i can get parsed contents from with
openssl pkcs7 -inform DER -in signature.pkcs7 -print_certs -text
But how do archieve the same output with PHPs openssl functions?
Edit. I succeeded in creating a correct PEM file with the following function:
function der2pem($der_data, $type="CERTIFICATE") {
$pem = chunk_split(base64_encode($der_data), 64, "\n");
$pem = "-----BEGIN $type-----\n".$pem."-----END $type-----\n";
return $pem;
}
$data = der2pem($der_data, "PKCS7");
Im not however successfull in parsing the data with any of the functions mentioned in the PHP manual. It works using openssl with:
openssl pkcs7 -inform PEM -in signature.pkcs7 -print_certs -text