Answer the question
In order to leave comments, you need to log in
Sign XML with OpenSSL in PHP (Solved)?
Good afternoon!
There is XML, I need to sign it in PKCS#7 format, I use openssl on php.
My code
if (openssl_pkcs7_sign($fileName.'.xml', $fileName.'_signed.xml', "cert.pem",
array("private.key", "passphrase"),
array("To" => "[email protected]", // keyed syntax
"From: [email protected]")
)) {
echo 111;
}
openssl smime -sign -in file.xml -signer cert.pem -inkey private.key -out file_signed.xml -outform PEM
139919525967512:error:0609E09C:digital envelope routines:PKEY_SET_TYPE:unsupported algorithm:p_lib.c:231:
139919525967512:error:0B07706F:x509 certificate routines:X509_PUBKEY_get:unsupported algorithm:x_pubkey.c:148:
139919525967512:error:0B080075:x509 certificate routines:X509_check_private_key:unknown key type:x509_cmp.c:346:
139919525967512:error:2108907F:PKCS7 routines:PKCS7_sign_add_signer:private key does not match certificate:pk7_smime.c:163:
139694728468120:error:0B080073:x509 certificate routines:X509_check_private_key:key type mismatch:x509_cmp.c:343:
139694728468120:error:2108907F:PKCS7 routines:PKCS7_sign_add_signer:private key does not match certificate:pk7_smime.c:163:
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question