diff --git a/dev/Model/Identity.js b/dev/Model/Identity.js index 78039eb62..138463810 100644 --- a/dev/Model/Identity.js +++ b/dev/Model/Identity.js @@ -25,6 +25,9 @@ export class IdentityModel extends AbstractModel { pgpSign: false, pgpEncrypt: false, + smimeKey: '', + smimeCertificate: '', + askDelete: false }); } diff --git a/dev/View/Popup/Identity.js b/dev/View/Popup/Identity.js index 5b2405e59..e9be978dc 100644 --- a/dev/View/Popup/Identity.js +++ b/dev/View/Popup/Identity.js @@ -38,6 +38,20 @@ export class IdentityPopupView extends AbstractViewPopup { ) ); this.defaultOptionsAfterRender = defaultOptionsAfterRender; + + this.createSelfSigned = this.createSelfSigned.bind(this); + } + + createSelfSigned() { + let identity = this.identity(); + Remote.request('CreateSMimeCertificate', (iError, oData) => { + if (oData.Result.x509) { + identity.smimeKey(oData.Result.pkey); + identity.smimeCertificate(oData.Result.x509); + } + }, { + email: identity.email() + }); } submitForm(form) { diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/SMime.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/SMime.php index d937bd3f1..d2a4a4864 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/SMime.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/SMime.php @@ -29,7 +29,7 @@ trait SMime \RainLoop\Providers\Storage\Enumerations\StorageType::ROOT ), '/') . '/.smime'; */ - $sEmail = $this->GetActionParam('Email', '') ?: $oAccount->Email(); + $sEmail = $this->GetActionParam('email', '') ?: $oAccount->Email(); $cert = new Certificate(); $cert->distinguishedName['emailAddress'] = $sEmail; diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php index 9c8002368..1c4d04ea6 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php @@ -17,7 +17,7 @@ trait User use Messages; use Attachments; use Pgp; -// use SMime; + use SMime; private ?Suggestions $oSuggestionsProvider = null; diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Identity.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Identity.php index e378dc903..73a63c7a9 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Identity.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Identity.php @@ -24,8 +24,11 @@ class Identity implements \JsonSerializable private bool $bSignatureInsertBefore = false; - private bool $bPgpEncrypt = false; - private bool $bPgpSign = false; + private bool $pgpEncrypt = false; + private bool $pgpSign = false; + + private string $SMimeKey = ''; + private string $SMimeCertificate = ''; function __construct(string $sId = '', string $sEmail = '') { @@ -95,8 +98,10 @@ class Identity implements \JsonSerializable $this->sSignature = !empty($aData['Signature']) ? $aData['Signature'] : ''; $this->bSignatureInsertBefore = !empty($aData['SignatureInsertBefore']); $this->sSentFolder = isset($aData['sentFolder']) ? $aData['sentFolder'] : ''; - $this->bPgpEncrypt = !empty($aData['pgpEncrypt']); - $this->bPgpSign = !empty($aData['pgpSign']); + $this->pgpEncrypt = !empty($aData['pgpEncrypt']); + $this->pgpSign = !empty($aData['pgpSign']); + $this->SMimeKey = isset($aData['smimeKey']) ? $aData['smimeKey'] : ''; + $this->SMimeCertificate = isset($aData['smimeCertificate']) ? $aData['smimeCertificate'] : ''; return true; } @@ -116,8 +121,10 @@ class Identity implements \JsonSerializable 'Signature' => $this->sSignature, 'SignatureInsertBefore' => $this->bSignatureInsertBefore, 'sentFolder' => $this->sSentFolder, - 'pgpEncrypt' => $this->bPgpEncrypt, - 'pgpSign' => $this->bPgpSign + 'pgpEncrypt' => $this->pgpEncrypt, + 'pgpSign' => $this->pgpSign, + 'smimeKey' => $this->SMimeKey, + 'smimeCertificate' => $this->SMimeCertificate ); } @@ -135,8 +142,10 @@ class Identity implements \JsonSerializable 'signature' => $this->sSignature, 'signatureInsertBefore' => $this->bSignatureInsertBefore, 'sentFolder' => $this->sSentFolder, - 'pgpEncrypt' => $this->bPgpEncrypt, - 'pgpSign' => $this->bPgpSign + 'pgpEncrypt' => $this->pgpEncrypt, + 'pgpSign' => $this->pgpSign, + 'smimeKey' => $this->SMimeKey, + 'smimeCertificate' => $this->SMimeCertificate ); } diff --git a/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html b/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html index d634bd174..e47063f8b 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html @@ -55,33 +55,55 @@