diff options
-rw-r--r-- | mail.php | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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']; } |