mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-04 03:18:49 +03:00
Verify S/MIME signed automatically and log Exception
This commit is contained in:
parent
b2009f6bc0
commit
27fbe01876
2 changed files with 13 additions and 6 deletions
|
|
@ -171,15 +171,22 @@ class MailClient
|
|||
$aFetchResponse = $this->oImapClient->Fetch($aFetchItems, $iIndex, $bIndexIsUid);
|
||||
if (\count($aFetchResponse)) {
|
||||
$oMessage = Message::fromFetchResponse($sFolderName, $aFetchResponse[0], $oBodyStructure);
|
||||
// S/MIME opaque signed. Verify it, so we have the raw mime body to show
|
||||
if ($oMessage->smimeSigned && !$oMessage->smimeSigned['detached']) {
|
||||
// S/MIME signed. Verify it, so we have the raw mime body to show
|
||||
if ($oMessage->smimeSigned) try {
|
||||
$bOpaque = !$oMessage->smimeSigned['detached'];
|
||||
$sBody = $this->oImapClient->FetchMessagePart(
|
||||
$oMessage->Uid,
|
||||
$oMessage->smimeSigned['partId']
|
||||
);
|
||||
$result = (new \SnappyMail\SMime\OpenSSL(''))->verify($sBody, null, true);
|
||||
$oMessage->smimeSigned['body'] = $result['body'];
|
||||
$oMessage->smimeSigned['verified'] = true;
|
||||
$result = (new \SnappyMail\SMime\OpenSSL(''))->verify($sBody, null, $bOpaque);
|
||||
if ($result) {
|
||||
if ($bOpaque) {
|
||||
$oMessage->smimeSigned['body'] = $result['body'];
|
||||
}
|
||||
$oMessage->smimeSigned['verified'] = $result['success'];
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$this->logException($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue