mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
#89 GnuPG verify cleartext messages
This commit is contained in:
parent
73fa215e22
commit
45a714ee08
3 changed files with 78 additions and 54 deletions
|
|
@ -177,19 +177,23 @@ export const PgpUserStore = new class {
|
|||
}
|
||||
|
||||
async verify(message) {
|
||||
const plain = message.plain();
|
||||
if (/-----BEGIN PGP SIGNED MESSAGE-----/.test(plain) && /-----BEGIN PGP SIGNATURE-----/.test(plain)) {
|
||||
return await OpenPGPUserStore.verify(message);
|
||||
}
|
||||
if (message.pgpSigned()) {
|
||||
const sender = message.from[0].email;
|
||||
let mode = await this.hasPublicKeyForEmails([sender]);
|
||||
if ('gnupg' === mode) {
|
||||
const signed = message.pgpSigned();
|
||||
if (signed) {
|
||||
const sender = message.from[0].email,
|
||||
gnupg = GnuPGUserStore.hasPublicKeyForEmails([sender]),
|
||||
openpgp = OpenPGPUserStore.hasPublicKeyForEmails([sender]);
|
||||
// Detached signature use GnuPG first, else we must download whole message
|
||||
if (gnupg && signed.SigPartId) {
|
||||
return GnuPGUserStore.verify(message);
|
||||
}
|
||||
if ('openpgp' === mode) {
|
||||
if (openpgp) {
|
||||
return OpenPGPUserStore.verify(message);
|
||||
}
|
||||
if (gnupg) {
|
||||
return GnuPGUserStore.verify(message);
|
||||
}
|
||||
// Mailvelope can't
|
||||
// https://github.com/mailvelope/mailvelope/issues/434
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue