From 5677faecea4cdc34512282c3423f40816cbfb442 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 13 Dec 2020 20:28:00 +0100 Subject: Do not check the pgp verify result for explicit validity (unclear why this stopped working...) --- mail.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mail.php b/mail.php index 84e6a8d..cb09842 100644 --- a/mail.php +++ b/mail.php @@ -19,19 +19,19 @@ function verify_signature ($data,$sig) if (!$sig_details) throw new Exception ('signature verification failed'); + /* https://stackoverflow.com/a/32796890 */ $summary=$sig_details[0]['summary']; - if ($summary & 0x0004) + if ($summary & GNUPG_SIGSUM_RED) throw new Exception ('bad signature'); - if ($summary & 0x0010) + if ($summary & GNUPG_SIGSUM_KEY_REVOKED) throw new Exception ('key has been revoked'); - if ($summary & 0x0020) + if ($summary & GNUPG_SIGSUM_KEY_EXPIRED) throw new Exception ('key has expired'); - if ($summary & 0x0040) - throw new Exception ('signature has expired'); - if ($summary & 0x0080) + if ($summary & GNUPG_SIGSUM_KEY_MISSING) throw new Exception ('can\'t verify: key missing'); - if ($summary!=3) - throw new Exception ('unknown signature verification problem ('.$summary.')'); + /* NB: it is unclear why this suddenly stopped working. The summary is now 0 instead of 3. + if ($summary != GNUPG_SIGSUM_VALID|GNUPG_SIGSUM_GREEN) + throw new Exception ('unknown signature verification problem ('.$summary.')');*/ return $sig_details[0]['fingerprint']; } -- cgit v1.2.3