mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-10-24 22:25:09 +03:00
Add intermediate certificates for S/MIME signing
This commit is contained in:
parent
8bf4727555
commit
dddf360db6
8 changed files with 39 additions and 4 deletions
|
|
@ -1255,6 +1255,7 @@ trait Messages
|
|||
$oPart->SubParts->append($oSignaturePart);
|
||||
} else {
|
||||
$sCertificate = $this->GetActionParam('signCertificate', '');
|
||||
$sCertificateChain = $this->GetActionParam('signCertificateChain', '');
|
||||
$sPrivateKey = $this->GetActionParam('signPrivateKey', '');
|
||||
if ('S/MIME' === $this->GetActionParam('sign', '')) {
|
||||
$sID = $this->GetActionParam('identityID', '');
|
||||
|
|
@ -1263,6 +1264,7 @@ trait Messages
|
|||
&& ($oIdentity->Id() === $sID || $oIdentity->Email() === $oFrom->GetEmail())
|
||||
) {
|
||||
$sCertificate = $oIdentity->smimeCertificate;
|
||||
$sCertificateChain = $oIdentity->smimeCertificateChain;
|
||||
$sPrivateKey = $oIdentity->smimeKey;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1303,6 +1305,7 @@ trait Messages
|
|||
|
||||
$SMIME = $this->SMIME();
|
||||
$SMIME->setCertificate($sCertificate);
|
||||
$SMIME->setCertificateChain($sCertificateChain);
|
||||
$SMIME->setPrivateKey($sPrivateKey, $oPassphrase);
|
||||
$sSignature = $SMIME->sign($tmp, $detached);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class Identity implements \JsonSerializable
|
|||
|
||||
private ?SensitiveString $smimeKey = null;
|
||||
private string $smimeCertificate = '';
|
||||
private string $smimeCertificateChain = '';
|
||||
|
||||
function __construct(string $sId = '', string $sEmail = '')
|
||||
{
|
||||
|
|
@ -114,6 +115,7 @@ class Identity implements \JsonSerializable
|
|||
$this->pgpSign = !empty($aData['pgpSign']);
|
||||
$this->smimeKey = new SensitiveString(isset($aData['smimeKey']) ? $aData['smimeKey'] : '');
|
||||
$this->smimeCertificate = isset($aData['smimeCertificate']) ? $aData['smimeCertificate'] : '';
|
||||
$this->smimeCertificateChain = isset($aData['smimeCertificateChain']) ? $aData['smimeCertificateChain'] : '';
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -136,7 +138,8 @@ class Identity implements \JsonSerializable
|
|||
'pgpEncrypt' => $this->pgpEncrypt,
|
||||
'pgpSign' => $this->pgpSign,
|
||||
'smimeKey' => (string) $this->smimeKey,
|
||||
'smimeCertificate' => $this->smimeCertificate
|
||||
'smimeCertificate' => $this->smimeCertificate,
|
||||
'smimeCertificateChain' => $this->smimeCertificateChain
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -158,6 +161,7 @@ class Identity implements \JsonSerializable
|
|||
'pgpSign' => $this->pgpSign,
|
||||
'smimeKey' => (string) $this->smimeKey,
|
||||
'smimeCertificate' => $this->smimeCertificate,
|
||||
'smimeCertificateChain' => $this->smimeCertificateChain,
|
||||
'exists' => $this->exists
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue