(defun epg-make-signature (status key-id user-id)
"Return a signature object."
- (vector status key-id user-id nil))
+ (vector status key-id user-id nil nil))
(defun epg-signature-status (signature)
"Return the status code of SIGNATURE."
"Return the validity of SIGNATURE."
(aref signature 3))
+(defun epg-signature-fingerprint (signature)
+ "Return the fingerprint of SIGNATURE."
+ (aref signature 4))
+
(defun epg-signature-set-status (signature status)
"Set the status code of SIGNATURE."
(aset signature 0 status))
"Set the validity of SIGNATURE."
(aset signature 3 validity))
+(defun epg-signature-set-fingerprint (signature fingerprint)
+ "Set the fingerprint of SIGNATURE."
+ (aset signature 4 fingerprint))
+
(defun epg-context-result-for (context name)
(cdr (assq name (epg-context-result context))))
(match-string 2 string))
(epg-context-result-for epg-context 'verify)))))
+(defun epg-status-VALIDSIG (process string)
+ (let ((signature (car (epg-context-result-for epg-context 'verify))))
+ (if (and signature
+ (eq (epg-signature-status signature) 'good)
+ (string-match "\\`\\([^ ]+\\) " string))
+ (epg-signature-set-fingerprint signature (match-string 1 string)))))
+
(defun epg-status-TRUST_UNDEFINED (process string)
(let ((signature (car (epg-context-result-for epg-context 'verify))))
(if (and signature
(eq (epg-signature-status signature) 'good))
- (epg-signature-set-validity signature 'unknown))))
+ (epg-signature-set-validity signature 'undefined))))
(defun epg-status-TRUST_NEVER (process string)
(let ((signature (car (epg-context-result-for epg-context 'verify))))
(let ((signature (car (epg-context-result-for epg-context 'verify))))
(if (and signature
(eq (epg-signature-status signature) 'good))
- (epg-signature-set-validity signature 'full))))
+ (epg-signature-set-validity signature 'fully))))
(defun epg-status-TRUST_ULTIMATE (process string)
(let ((signature (car (epg-context-result-for epg-context 'verify))))
(if (and signature
(eq (epg-signature-status signature) 'good))
- (epg-signature-set-validity signature 'full))))
+ (epg-signature-set-validity signature 'ultimate))))
(defun epg-status-PROGRESS (process string)
(if (string-match "\\`\\([^ ]+\\) \\([^ ]\\) \\([0-9]+\\) \\([0-9]+\\)"
(insert signature))
t))
+(defvar pgg-epg-signature nil)
+
(defun pgg-epg-verify-region (start end &optional signature)
"This function is for internal use only.
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"
(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