mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
Automatically verify S/MIME decrypted signed message
This commit is contained in:
parent
d1466ad2f2
commit
34106c937e
2 changed files with 12 additions and 1 deletions
|
|
@ -656,6 +656,9 @@ export class MailMessageView extends AbstractViewRight {
|
|||
MimeToMessage(response.Result.data, message);
|
||||
message.html() ? message.viewHtml() : message.viewPlain();
|
||||
pass && pass.remember && Passphrases.set(identity, pass.password);
|
||||
if ('signed' in response.Result) {
|
||||
message.smimeSigned(response.Result.signed);
|
||||
}
|
||||
}
|
||||
}).catch(e => {
|
||||
data.error = e.message
|
||||
|
|
|
|||
|
|
@ -104,8 +104,16 @@ trait SMime
|
|||
$SMIME->setCertificate($sCertificate);
|
||||
$SMIME->setPrivateKey($sPrivateKey, $oPassphrase);
|
||||
$result = $SMIME->decrypt($sBody);
|
||||
if ($result) {
|
||||
$result = ['data' => $result];
|
||||
if (\str_contains($result['data'], 'multipart/signed')) {
|
||||
$result['signed'] = [
|
||||
'success' => !empty($SMIME->verify($result['data'], null, true)['success'])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->DefaultResponse($result ? ['data' => $result] : false);
|
||||
return $this->DefaultResponse($result ?: false);
|
||||
}
|
||||
|
||||
public function DoSMimeVerifyMessage() : array
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue