Make smime encryption failure message more specific

This commit is contained in:
Hadi Nategh 2017-09-08 13:40:25 +02:00
parent f16ca103ab
commit bebf9d74cc

View File

@ -3680,7 +3680,7 @@ class mail_compose
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))
{ {
$sender_cert = $AB->get_smime_keys($sender); $sender_cert = $AB->get_smime_keys($sender);
if (!$sender_cert) throw new Exception("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[$sender];
$acc_smime = Mail\Smime::get_acc_smime($this->mail_bo->profileID, $params['passphrase']); $acc_smime = Mail\Smime::get_acc_smime($this->mail_bo->profileID, $params['passphrase']);
$params['senderPrivKey'] = $acc_smime['pkey']; $params['senderPrivKey'] = $acc_smime['pkey'];
@ -3694,7 +3694,7 @@ class mail_compose
{ {
if (!$params['recipientsCerts'][$recipient]) $missingCerts []= $recipient; if (!$params['recipientsCerts'][$recipient]) $missingCerts []= $recipient;
} }
if (is_array($missingCerts)) throw new Exception ('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));
} }
return $mail->smimeEncrypt($type, $params); return $mail->smimeEncrypt($type, $params);