1. Dock an interface, the other side"s interface is written by java, I am php, the other party gave two files, a public key .cer, a private key .pfx,
I use openssl_pkcs12_read () to read pfx to sign.
openssl_pkcs12_read(file_get_contents("./private.pfx"), $certs, "sft12-sharp");
if(!$certs) exit(0);
openssl_sign($data, $signature, $certs["pkey"]);
$signature = base64_encode($signature);
how to read .cer for signature verification
$cer_key = file_get_contents("./public.cer");
$cer = openssl_x509_read($cer_key);
openssl_x509_read this function will report an error
openssl_x509_read (): supplied parameter cannot be coerced into an X509 certificate!
it should be wrong to use openssl_x509_read, so what should be done? Or use the openssl command to convert to pem! Hope to get guidance
x509-inform der-in test.cer-out test.pem