X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=pgg-epg.el;h=1c8a1332426ddc6a515714c61e1309547d8ba047;hb=f7a28f60f11e7a71c5bfa97f3e420c86ca492a65;hp=0b12becc198079064e66df17c63a31305c2103fa;hpb=5d6177e27165594f4780b44755538c540b61d26c;p=elisp%2Fepg.git diff --git a/pgg-epg.el b/pgg-epg.el index 0b12bec..1c8a133 100644 --- a/pgg-epg.el +++ b/pgg-epg.el @@ -1,3 +1,30 @@ +;;; pgg-epg.el --- Gnus/PGG backend of EasyPG. +;; Copyright (C) 1999, 2000, 2002, 2003, 2004, +;; 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2006 Daiki Ueno + +;; Author: Daiki Ueno +;; Keywords: PGP, GnuPG + +;; This file is part of EasyPG. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + (require 'epg) (eval-when-compile (require 'pgg)) @@ -72,6 +99,8 @@ passphrase cache or user." (insert signature)) t)) +(defvar pgg-epg-signature nil) + (defun pgg-epg-verify-region (start end &optional signature) "This function is for internal use only. @@ -81,12 +110,14 @@ Verify region between START and END as the detached signature SIGNATURE." (epg-context-set-armor context t) (epg-context-set-textmode context pgg-text-mode) (if signature - (epg-verify-file context signature (buffer-substring start end)) + (epg-verify-file context signature (buffer-substring start end) nil) (epg-verify-string context (buffer-substring start end))) (setq signature (reverse (epg-context-result-for context 'verify)) pointer signature) (save-excursion (set-buffer (get-buffer-create pgg-errors-buffer)) + (make-local-variable 'pgg-epg-signature) + (setq pgg-epg-signature (car signature)) (erase-buffer) (while pointer (insert (format "%s: %s %s %s\n" @@ -117,6 +148,28 @@ Add all public keys in region between START and END to the keyring." (epg-context-set-textmode context pgg-text-mode) (epg-import-keys context (buffer-substring start end)))) +(defun mml2015-gpg-extract-signature-details () + (if pgg-epg-signature + (let* ((expired (eq (epg-signature-status pgg-epg-signature) + 'key-expired)) + (signer (cons (epg-signature-key-id pgg-epg-signature) + (epg-signature-user-id pgg-epg-signature))) + (fprint (epg-signature-fingerprint pgg-epg-signature)) + (trust-good-enough-p + (memq (epg-signature-validity pgg-epg-signature) + '(marginal fully ultimate)))) + (cond ((and signer fprint) + (concat (cdr signer) + (unless trust-good-enough-p + (concat "\nUntrusted, Fingerprint: " + (mml2015-gpg-pretty-print-fpr fprint))) + (when expired + (format "\nWARNING: Signature from expired key (%s)" + (car signer))))) + (t + "From unknown user"))) + "From unknown user")) + (provide 'pgg-epg) ;;; pgg-epg.el ends here