aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2020-12-13 20:28:00 +0100
committerCamil Staps2020-12-13 20:28:00 +0100
commit5677faecea4cdc34512282c3423f40816cbfb442 (patch)
tree71cc2c88030fdb66f06be85e66ab25dcfa75837e
parentHide expired events by default; add link to show/hide them (diff)
Do not check the pgp verify result for explicit validity (unclear why this stopped working...)HEADmaster
-rw-r--r--mail.php16
1 files 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'];
}