"Set the result of the previous cryptographic operation."
(aset context 12 result))
-(defun epg-make-verify-result (status key-id user-id)
- "Return a verify-result object."
+(defun epg-make-signature (status key-id user-id)
+ "Return a signature object."
(vector status key-id user-id nil nil))
-(defun epg-verify-result-status (verify-result)
- "Return the status code of VERIFY-RESULT."
- (aref verify-result 0))
+(defun epg-signature-status (signature)
+ "Return the status code of SIGNATURE."
+ (aref signature 0))
-(defun epg-verify-result-key-id (verify-result)
- "Return the key-id of VERIFY-RESULT."
- (aref verify-result 1))
+(defun epg-signature-key-id (signature)
+ "Return the key-id of SIGNATURE."
+ (aref signature 1))
-(defun epg-verify-result-user-id (verify-result)
- "Return the user-id of VERIFY-RESULT."
- (aref verify-result 2))
+(defun epg-signature-user-id (signature)
+ "Return the user-id of SIGNATURE."
+ (aref signature 2))
-(defun epg-verify-result-validity (verify-result)
- "Return the validity of VERIFY-RESULT."
- (aref verify-result 3))
+(defun epg-signature-validity (signature)
+ "Return the validity of SIGNATURE."
+ (aref signature 3))
-(defun epg-verify-result-fingerprint (verify-result)
- "Return the fingerprint of VERIFY-RESULT."
- (aref verify-result 4))
+(defun epg-signature-fingerprint (signature)
+ "Return the fingerprint of SIGNATURE."
+ (aref signature 4))
-(defun epg-verify-result-set-status (verify-result status)
- "Set the status code of VERIFY-RESULT."
- (aset verify-result 0 status))
+(defun epg-signature-set-status (signature status)
+ "Set the status code of SIGNATURE."
+ (aset signature 0 status))
-(defun epg-verify-result-set-key-id (verify-result key-id)
- "Set the key-id of VERIFY-RESULT."
- (aset verify-result 1 key-id))
+(defun epg-signature-set-key-id (signature key-id)
+ "Set the key-id of SIGNATURE."
+ (aset signature 1 key-id))
-(defun epg-verify-result-set-user-id (verify-result user-id)
- "Set the user-id of VERIFY-RESULT."
- (aset verify-result 2 user-id))
+(defun epg-signature-set-user-id (signature user-id)
+ "Set the user-id of SIGNATURE."
+ (aset signature 2 user-id))
-(defun epg-verify-result-set-validity (verify-result validity)
- "Set the validity of VERIFY-RESULT."
- (aset verify-result 3 validity))
+(defun epg-signature-set-validity (signature validity)
+ "Set the validity of SIGNATURE."
+ (aset signature 3 validity))
-(defun epg-verify-result-set-fingerprint (verify-result fingerprint)
- "Set the fingerprint of VERIFY-RESULT."
- (aset verify-result 4 fingerprint))
+(defun epg-signature-set-fingerprint (signature fingerprint)
+ "Set the fingerprint of SIGNATURE."
+ (aset signature 4 fingerprint))
(defun epg-make-key (owner-trust)
"Return a key object."
"Return the name of USER-ID."
(aref user-id 1))
-(defun epg-user-id-verify-result-list (user-id)
- "Return the verify-result list of USER-ID."
+(defun epg-user-id-signature-list (user-id)
+ "Return the signature list of USER-ID."
(aref user-id 2))
-(defun epg-user-id-set-verify-result-list (user-id verify-result-list)
- "Set the verify-result list of USER-ID."
- (aset user-id 2 verify-result-list))
+(defun epg-user-id-set-signature-list (user-id signature-list)
+ "Set the signature list of USER-ID."
+ (aset user-id 2 signature-list))
(defun epg-context-result-for (context name)
(cdr (assq name (epg-context-result context))))
(setcdr entry value)
(epg-context-set-result context (cons (cons name value) result)))))
-(defun epg-verify-result-to-string (verify-result)
- (format "%s verify-result from %s %s%s"
- (capitalize (symbol-name (epg-verify-result-status verify-result)))
- (epg-verify-result-key-id verify-result)
- (epg-verify-result-user-id verify-result)
- (if (epg-verify-result-validity verify-result)
+(defun epg-signature-to-string (signature)
+ (format "%s signature from %s %s%s"
+ (capitalize (symbol-name (epg-signature-status signature)))
+ (epg-signature-key-id signature)
+ (epg-signature-user-id signature)
+ (if (epg-signature-validity signature)
(format " (trust %s)"
- (epg-verify-result-validity verify-result))
+ (epg-signature-validity signature))
"")))
+(defun epg-verify-result-to-string (verify-result)
+ (mapconcat #'epg-signature-to-string (reverse verify-result) "\n"))
+
(defun epg-start (context args)
"Start `epg-gpg-program' in a subprocess with given ARGS."
(let* ((args (append (list "--no-tty"
(epg-context-set-result-for
epg-context
'verify
- (cons (epg-make-verify-result 'good
+ (cons (epg-make-signature 'good
(match-string 1 string)
(match-string 2 string))
(epg-context-result-for epg-context 'verify)))))
(epg-context-set-result-for
epg-context
'verify
- (cons (epg-make-verify-result 'expired
+ (cons (epg-make-signature 'expired
(match-string 1 string)
(match-string 2 string))
(epg-context-result-for epg-context 'verify)))))
(epg-context-set-result-for
epg-context
'verify
- (cons (epg-make-verify-result 'expired-key
+ (cons (epg-make-signature 'expired-key
(match-string 1 string)
(match-string 2 string))
(epg-context-result-for epg-context 'verify)))))
(epg-context-set-result-for
epg-context
'verify
- (cons (epg-make-verify-result 'revoked-key
+ (cons (epg-make-signature 'revoked-key
(match-string 1 string)
(match-string 2 string))
(epg-context-result-for epg-context 'verify)))))
(epg-context-set-result-for
epg-context
'verify
- (cons (epg-make-verify-result 'bad
+ (cons (epg-make-signature 'bad
(match-string 1 string)
(match-string 2 string))
(epg-context-result-for epg-context 'verify)))))
(defun epg-status-VALIDSIG (process string)
- (let ((verify-result (car (epg-context-result-for epg-context 'verify))))
- (if (and verify-result
- (eq (epg-verify-result-status verify-result) 'good)
+ (let ((signature (car (epg-context-result-for epg-context 'verify))))
+ (if (and signature
+ (eq (epg-signature-status signature) 'good)
(string-match "\\`\\([^ ]+\\) " string))
- (epg-verify-result-set-fingerprint verify-result (match-string 1 string)))))
+ (epg-signature-set-fingerprint signature (match-string 1 string)))))
(defun epg-status-TRUST_UNDEFINED (process string)
- (let ((verify-result (car (epg-context-result-for epg-context 'verify))))
- (if (and verify-result
- (eq (epg-verify-result-status verify-result) 'good))
- (epg-verify-result-set-validity verify-result 'undefined))))
+ (let ((signature (car (epg-context-result-for epg-context 'verify))))
+ (if (and signature
+ (eq (epg-signature-status signature) 'good))
+ (epg-signature-set-validity signature 'undefined))))
(defun epg-status-TRUST_NEVER (process string)
- (let ((verify-result (car (epg-context-result-for epg-context 'verify))))
- (if (and verify-result
- (eq (epg-verify-result-status verify-result) 'good))
- (epg-verify-result-set-validity verify-result 'never))))
+ (let ((signature (car (epg-context-result-for epg-context 'verify))))
+ (if (and signature
+ (eq (epg-signature-status signature) 'good))
+ (epg-signature-set-validity signature 'never))))
(defun epg-status-TRUST_MARGINAL (process string)
- (let ((verify-result (car (epg-context-result-for epg-context 'verify))))
- (if (and verify-result
- (eq (epg-verify-result-status verify-result) 'marginal))
- (epg-verify-result-set-validity verify-result 'marginal))))
+ (let ((signature (car (epg-context-result-for epg-context 'verify))))
+ (if (and signature
+ (eq (epg-signature-status signature) 'marginal))
+ (epg-signature-set-validity signature 'marginal))))
(defun epg-status-TRUST_FULLY (process string)
- (let ((verify-result (car (epg-context-result-for epg-context 'verify))))
- (if (and verify-result
- (eq (epg-verify-result-status verify-result) 'good))
- (epg-verify-result-set-validity verify-result 'full))))
+ (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))))
(defun epg-status-TRUST_ULTIMATE (process string)
- (let ((verify-result (car (epg-context-result-for epg-context 'verify))))
- (if (and verify-result
- (eq (epg-verify-result-status verify-result) 'good))
- (epg-verify-result-set-validity verify-result 'ultimate))))
+ (let ((signature (car (epg-context-result-for epg-context 'verify))))
+ (if (and signature
+ (eq (epg-signature-status signature) 'good))
+ (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-verify-results nil)
+(defvar pgg-epg-signatures nil)
(defun pgg-epg-verify-region (start end &optional signature)
"This function is for internal use only.
Verify region between START and END as the detached signature SIGNATURE."
- (let ((context (epg-make-context))
- verify-results)
+ (let ((context (epg-make-context)))
(epg-context-set-armor context t)
(epg-context-set-textmode context pgg-text-mode)
(if signature
(buffer-string))
(buffer-substring start end))
(epg-verify-string context (buffer-substring start end)))
- (setq verify-results (reverse (epg-context-result-for context 'verify)))
(save-excursion
(set-buffer (get-buffer-create pgg-errors-buffer))
- (make-local-variable 'pgg-epg-verify-results)
- (setq pgg-epg-verify-results (car verify-results))
+ (make-local-variable 'pgg-epg-signatures)
+ (setq pgg-epg-signatures (epg-context-result-for context 'verify))
(erase-buffer)
- (insert (mapconcat #'epg-verify-result-to-string verify-results "\n")))
+ (insert (epg-verify-result-to-string pgg-epg-signatures)))
t))
(defun pgg-epg-insert-key ()
(epg-context-set-textmode context pgg-text-mode)
(epg-import-keys context (buffer-substring start end))))
-(defun mml2015-gpg-extract-verify-result-details ()
- (if pgg-epg-verify-result
- (let* ((expired (eq (epg-verify-result-status pgg-epg-verify-result)
+(defun mml2015-gpg-extract-signature-details ()
+ (if pgg-epg-signature
+ (let* ((expired (eq (epg-signature-status pgg-epg-signature)
'key-expired))
- (signer (cons (epg-verify-result-key-id pgg-epg-verify-result)
- (epg-verify-result-user-id pgg-epg-verify-result)))
- (fprint (epg-verify-result-fingerprint pgg-epg-verify-result))
+ (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-verify-result-validity pgg-epg-verify-result)
+ (memq (epg-signature-validity pgg-epg-signature)
'(marginal fully ultimate))))
(cond ((and signer fprint)
(concat (cdr signer)