WIP of SMIME support: Implement an interface for importing smime private key into mail account

This commit is contained in:
Hadi Nategh 2017-01-25 18:06:17 +01:00
parent 572ae1d77e
commit 34e04a1315
2 changed files with 42 additions and 0 deletions

View File

@ -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']);

View File

@ -285,6 +285,31 @@
</rows>
</grid>
</template>
<template id="admin.mailaccount.encryption" template="" lang="" group="0" version="1.9.001">
<grid width="100%">
<columns>
<column width="115"/>
<column/>
</columns>
<rows>
<row>
<description value="SMIME"/>
</row>
<row>
<description value="Paste your private key as text here or upload your .key/.p12 file"/>
<textbox multiline="true" id="acc_smime_password" height="150" width="70%"/>
</row>
<row>
<description/>
<file id="smimeKeyUpload" accept=".key,.p12"/>
</row>
<row>
<description for="smime_pkcs12_password" value="Password to unlock encrypted p12"/>
<passwd id="smime_pkcs12_password" size="32" maxlength="128" autocomplete="off"/>s
</row>
</rows>
</grid>
</template>
<template id="admin.mailaccount" template="" lang="" group="0" version="1.9.001">
<grid width="100%">
<columns>
@ -325,6 +350,7 @@
<tab id="admin.mailaccount.sieve" label="Sieve" statustext="serverside filtering"/>
<tab id="admin.mailaccount.smtp" label="SMTP" statustext="outgoing mail"/>
<tab id="admin.mailaccount.aliases" label="Aliases+Forwards" statustext="Aliases, Forwarding, Quota, ..."/>
<tab id="admin.mailaccount.encryption" label="Encryption" statustext="Encryption settings"/>
</tabs>
<tabpanels>
<template id="admin.mailaccount.identity"/>
@ -333,6 +359,7 @@
<template id="admin.mailaccount.sieve"/>
<template id="admin.mailaccount.smtp"/>
<template id="admin.mailaccount.aliases"/>
<template id="admin.mailaccount.encryption"/>
</tabpanels>
</tabbox>
</row>