Handle S/MIME encrypt, decrypt, sign and very everywhere #259

This commit is contained in:
the-djmaze 2024-02-20 16:03:22 +01:00
parent 44a623543f
commit 5a2d2fd0e5
7 changed files with 85 additions and 48 deletions

View file

@ -1194,6 +1194,17 @@ trait Messages
$oMessage->Attachments()->Clear();
$SMIME = $this->SMIME();
$certificates = $SMIME->certificates();
// Load certificates by id
foreach ($aCertificates as &$sCertificate) {
if (!\str_contains($sCertificate, '-----BEGIN CERTIFICATE-----')) {
foreach ($certificates as $certificate) {
if ($certificate['id'] === $sCertificate) {
$sCertificate = $SMIME->getCertificate($certificate['file']);
}
}
}
}
$sEncrypted = $SMIME->encrypt($tmp, $aCertificates);
$oPart = new MimePart;