* Mail: fix S/MIME fails with addresses not written in lowercase

This commit is contained in:
Hadi Nategh 2019-03-25 17:12:00 +01:00
parent 0324c7d6e6
commit 881b690aae
2 changed files with 3 additions and 3 deletions

View File

@ -7608,7 +7608,7 @@ class Mail
$params = array ( $params = array (
'type' => 'message', 'type' => 'message',
'pubkey' => $certkey[$acc_smime['acc_smime_username']], 'pubkey' => $certkey[strtolower($acc_smime['acc_smime_username'])],
'privkey' => $acc_smime['pkey'], 'privkey' => $acc_smime['pkey'],
'passphrase'=> $_passphrase 'passphrase'=> $_passphrase
); );

View File

@ -3829,7 +3829,7 @@ class mail_compose
{ {
$sender_cert = $AB->get_smime_keys($sender); $sender_cert = $AB->get_smime_keys($sender);
if (!$sender_cert) throw new Exception("S/MIME Encryption failed because no certificate has been found for sender address: " . $sender); if (!$sender_cert) throw new Exception("S/MIME Encryption failed because no certificate has been found for sender address: " . $sender);
$params['senderPubKey'] = $sender_cert[$sender]; $params['senderPubKey'] = $sender_cert[strtolower($sender)];
if (isset($sender) && ($type == Mail\Smime::TYPE_SIGN || $type == Mail\Smime::TYPE_SIGN_ENCRYPT)) if (isset($sender) && ($type == Mail\Smime::TYPE_SIGN || $type == Mail\Smime::TYPE_SIGN_ENCRYPT))
{ {
@ -3843,7 +3843,7 @@ class mail_compose
$params['recipientsCerts'] = $AB->get_smime_keys($recipients); $params['recipientsCerts'] = $AB->get_smime_keys($recipients);
foreach ($recipients as &$recipient) foreach ($recipients as &$recipient)
{ {
if (!$params['recipientsCerts'][$recipient]) $missingCerts []= $recipient; if (!$params['recipientsCerts'][strtolower($recipient)]) $missingCerts []= $recipient;
} }
if (is_array($missingCerts)) throw new Exception ('S/MIME Encryption failed because no certificate has been found for following addresses: '. implode ('|', $missingCerts)); if (is_array($missingCerts)) throw new Exception ('S/MIME Encryption failed because no certificate has been found for following addresses: '. implode ('|', $missingCerts));
} }