PHP OpenSSL - Problem with "openssl_pkcs7_verify"
| From: | Samuel Lopes Grigolato | Date: | Sat, 21 Jul 2012 18:21:24 +0000 |
| Subject: | PHP OpenSSL - Problem with "openssl_pkcs7_verify" | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-318550@lists.php.net to get a copy of this message | ||
Hello,
I'm having some trouble trying to put the "openssl_pkcs7_verify" function to
work.
I have a file signed with a valid certificate with this software:
<http://www.signfiles.com/p7s-signer/> http://www.signfiles.com/p7s-signer/
What I'm trying to achieve is to extract the contents of the signed file
inside PHP. This is what I've got looking to php.net documentation:
$path = "fullpath/filename.p7s";
$results = openssl_pkcs7_verify($path, 0);
//$results = openssl_pkcs7_verify($path, PKCS7_BINARY); same problem
//$results = openssl_pkcs7_verify($path, PKCS7_TEXT); same problem
echo "Verification results: " . $results;
while ($msg = openssl_error_string()) {
echo "\n" . $msg;
}
When I execute this piece of script the following output is echoed:
Verification results: -1
error:02001003:system library:fopen:No such process
error:2006D080:BIO routines:BIO_new_file:no such file
error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
error:0B065068:x509 certificate routines:BY_FILE_CTRL:loading defaults
error:0D0D20CC:asn1 encoding routines:SMIME_read_ASN1:no content type
This is the php -version output:
PHP 5.4.5 (cli) (built: Jul 18 2012 22:25:51)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
I'm on Windows 7 64 bits operating system, the binary is the latest stable
build available today on php.net.
Could someone please suggest what else can I try? Tried to google
"SMIME_read_ASN1:no content type" but nothing so far.
Regards,
Samuel.