note 124937 deleted from function.openssl-pkcs7-encrypt by cmb
| From: | cmb@php.net | Date: | Thu, 23 Apr 2020 13:27:31 +0000 |
| Subject: | note 124937 deleted from function.openssl-pkcs7-encrypt by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214525@lists.php.net to get a copy of this message | ||
Note Submitter: Matthias Barkhausen
----
To successfully sign and encrypt an plain text E-Mail to send to and to be able to read by Outlook
and iOS Mail you need to first sign w/o headers and use the PKCS7_TEXT constant, then encrypt with
headers and cipherid 3DES, then send with sendmail/ssmtp with -t option.
Reason for 3DES ist that iOS (or Apple in general) doesnt further accept the RC40 default encryption
openssl-pkcs7-encrypt is using. Outlook would decrypt such encryption, but iOS Mail just said
"this mail has no content" and "install a profile containing your identity...".
$headers = array("To" => ...,
"From" => ...,
"Subject" => ...);
openssl_pkcs7_sign("msg.txt","signed.txt",
$mMyCertFileToIncludeForRecipient,array($mMyPrivKeyFileAsPEM,
"passphrase"),array(),PKCS7_TEXT);
openssl_pkcs7_encrypt("signed.txt","enc.txt",$pubkeyContents,$headers,0,OPENSSL_CIPHER_3DES);
shell_exec("ssmtp -t < enc.txt") #sendmail same syntax