note 61857 modified in function.openssl-pkcs7-verify by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 Jan 2010 15:11:18 +0000 |
| Subject: | note 61857 modified in function.openssl-pkcs7-verify by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165083@lists.php.net to get a copy of this message | ||
There is a hidden sixth argument: string pointing to a file where the contents of the signed message
should be saved.
It is very important for verifying signed and encrypted messages from MS Outlook which uses opaque
signing. After decrypting of message you will get another MIME envelope like this:
MIME-Version: 1.0
Content-Disposition: attachment; filename="smime.p7m"
Content-Type: application/x-pkcs7-mime; smime-type=signed-data; name="smime.p7m"
Content-Transfer-Encoding: base64
MIIM/QYJ...
Even if you use base64_decode() you will not get decrypted message but PKCS #7 object.
BTW: How to create opaque signed message like from MS Outlook? Switch off PKCS7_DETACHED flag (the
last 0 does it):
<?php
openssl_pkcs7_sign(
"full_path_to_message_file",
"full_path_where_to_store_signed_message_file",
"file://full_path_to_my_public_certificate.pem",
array("file://full_path_to_my_private_key.pem", "password"),
array(),
0
);
?>
--was--
There is a hidden sixth argument: string pointing to a file where the contents of the signed message
should be saved.
It is very important for verifying signed and encrypted messages from MS Outlook which uses opaque
signing. After decrypting of message you will get another MIME envelope like this:
MIME-Version: 1.0
Content-Disposition: attachment; filename="smime.p7m"
Content-Type: application/x-pkcs7-mime; smime-type=signed-data; name="smime.p7m"
Content-Transfer-Encoding: base64
MIIM/QYJ...
Even if you use base64_decode() you will not get decrypted message but PKCS #7 object.
BTW: How to create opaque signed message like from MS Outlook? Switch off PKCS7_DETACHED flag (the
last 0 does it):
openssl_pkcs7_sign(
"full_path_to_message_file",
"full_path_where_to_store_signed_message_file",
"file://full_path_to_my_public_certificate.pem",
array("file://full_path_to_my_private_key.pem", "password"),
array(),
0
);
http://php.net/manual/en/function.openssl-pkcs7-verify.php