From 34e04a1315c7edd0cb0f70267c595d775bd0144b Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 25 Jan 2017 18:06:17 +0100 Subject: [PATCH] WIP of SMIME support: Implement an interface for importing smime private key into mail account --- admin/inc/class.admin_mail.inc.php | 15 ++++++++++++++ admin/templates/default/mailaccount.xet | 27 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/admin/inc/class.admin_mail.inc.php b/admin/inc/class.admin_mail.inc.php index 6ff8d4485d..292d85195a 100644 --- a/admin/inc/class.admin_mail.inc.php +++ b/admin/inc/class.admin_mail.inc.php @@ -951,6 +951,21 @@ class admin_mail $tpl->disableElement('notify_save_default', !$is_multiple || !$edit_access); $tpl->disableElement('notify_use_default', !$is_multiple); + if (isset($content['smimeKeyUpload']) + && ($pkcs12 = file_get_contents($content['smimeKeyUpload']['tmp_name']))) + { + $smime = new Mail\Smime; + switch($content['smimeKeyUpload']['type']) + { + case 'application/x-pkcs12': + $cert_info = $smime->extractCertPKCS12($pkcs12, $content['smime_pkcs12_password']); + $content['acc_smime_password'] = $cert_info['pkey']; + break; + case 'application/x-iwork-keynote-sffkey': + $content['acc_smime_password'] = $pkcs12; + break; + } + } if (isset($content['button'])) { list($button) = each($content['button']); diff --git a/admin/templates/default/mailaccount.xet b/admin/templates/default/mailaccount.xet index 77ce513af5..4951dd6f0a 100644 --- a/admin/templates/default/mailaccount.xet +++ b/admin/templates/default/mailaccount.xet @@ -285,6 +285,31 @@ +