'openssl_pkcs7_verify(): signature OK, but cannot open for writing
I'm trying to decrypt a payload from a request it's working to decrypt but give me this error
I searched a lot but can't find nothing specific.
I also used this print_r(openssl_error_string()); to see what errors are coming and on refresh give me on of these
error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
error:21075075:PKCS7 routines:PKCS7_verify:certificate verify error
error:2006D080:BIO routines:BIO_new_file:no such file
error:0D0D40D1:asn1 encoding routines:SMIME_read_ASN1:no content type
$is_verified = openssl_pkcs7_verify(
$tmp_smime_message_file->path,
PKCS7_BINARY | PKCS7_NOCHAIN | PKCS7_NOINTERN,
null,
[__DIR__ . '/bundle.crt'],
__DIR__ . '/test_public.crt',
$tmp_decrypted_and_verified_message_file->path
);
Thanks a lot
Solution 1:[1]
From openssl_pkcs7_verify doc-block:
If the outfilename is specified, it should be a string holding the name of a file into which the certificates of the persons that signed the messages will be stored in PEM format.
So, you need indicate valid file path in $signers_certificates_filename instead of current null value
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | webenter |