From 229752b4dde6de98a9081e17724bc3a5e740283e Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 17 Aug 2018 11:50:26 +0200 Subject: [PATCH] * Mail: fix S/MIME encrypted only composed mail fails --- mail/inc/class.mail_compose.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 64bf900130..9be65df58a 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -3821,11 +3821,12 @@ class mail_compose try { + $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); + $params['senderPubKey'] = $sender_cert[$sender]; + if (isset($sender) && ($type == Mail\Smime::TYPE_SIGN || $type == Mail\Smime::TYPE_SIGN_ENCRYPT)) { - $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); - $params['senderPubKey'] = $sender_cert[$sender]; $acc_smime = Mail\Smime::get_acc_smime($this->mail_bo->profileID, $params['passphrase']); $params['senderPrivKey'] = $acc_smime['pkey']; $params['extracerts'] = $acc_smime['extracerts'];