From: ueno Date: Sat, 29 Apr 2006 06:00:49 +0000 (+0000) Subject: * epg.el (epg-status-ERRSIG): New function. X-Git-Tag: epg-0_0_2~89 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=695632d136cacde5ae5abcee3f8894ef45c2149e;p=elisp%2Fepg.git * epg.el (epg-status-ERRSIG): New function. (epg-verify-file): Signal an error if we encounter ERRSIG status. (epg-verify-string): Ditto. --- diff --git a/ChangeLog b/ChangeLog index d9b5fa7..c5c3955 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 2006-04-29 Daiki Ueno - * epg.el (epg-status-NO_PUBKEY): New function. - (epg-status-NO_SECKEY): New function. + * epg.el (epg-status-ERRSIG): New function. + (epg-verify-file): Signal an error if we encounter ERRSIG status. + (epg-verify-string): Ditto. 2006-04-28 Daiki Ueno diff --git a/epg.el b/epg.el index 68c1041..3a2a1c1 100644 --- a/epg.el +++ b/epg.el @@ -849,6 +849,24 @@ This function is for internal use only." (match-string 2 string))) (epg-context-result-for epg-context 'verify))))) +(defun epg-status-ERRSIG (process string) + (if (string-match "\\`\\([^ ]+\\) \\([0-9]+\\) \\([0-9]+\\) \ +\\([0-9A-Fa-f][0-9A-Fa-f]\\) \\([^ ]+\\) \\([0-9]+\\)" + string) + (epg-context-set-result-for + epg-context + 'verify + (cons (list (cons 'key-id (match-string 1 string)) + (cons 'pubkey-algorithm + (string-to-number (match-string 2 string))) + (cons 'digest-algorithm + (string-to-number (match-string 3 string))) + (cons 'class + (string-to-number (match-string 4 string))) + (cons 'creation-time (match-string 5 string)) + (cons 'rc (string-to-number (match-string 6 string)))) + (epg-context-result-for epg-context 'error))))) + (defun epg-status-VALIDSIG (process string) (let ((signature (car (epg-context-result-for epg-context 'verify)))) (if (and signature @@ -886,18 +904,6 @@ This function is for internal use only." (eq (epg-signature-status signature) 'good)) (epg-signature-set-validity signature 'ultimate)))) -(defun epg-status-NO_PUBKEY (process string) - (epg-context-set-result-for - epg-context 'error - (cons (cons 'no-pubkey string) - (epg-context-result-for epg-context 'error)))) - -(defun epg-status-NO_SECKEY (process string) - (epg-context-set-result-for - epg-context 'error - (cons (cons 'no-seckey string) - (epg-context-result-for epg-context 'error)))) - (defun epg-status-PROGRESS (process string) (if (string-match "\\`\\([^ ]+\\) \\([^ ]\\) \\([0-9]+\\) \\([0-9]+\\)" string) @@ -1291,6 +1297,9 @@ For a normal or a clear text signature, SIGNED-TEXT should be nil." (epg-start-verify context (epg-make-data-from-file signature))) (epg-wait-for-completion context) + (if (epg-context-result-for context 'error) + (error "Verify failed: %S" + (epg-context-result-for context 'error))) (unless plain (epg-read-output context))) (unless plain @@ -1320,6 +1329,9 @@ For a normal or a clear text signature, SIGNED-TEXT should be nil." (epg-start-verify context (epg-make-data-from-string signature))) (epg-flush context) (epg-wait-for-completion context) + (if (epg-context-result-for context 'error) + (error "Verify failed: %S" + (epg-context-result-for context 'error))) (epg-read-output context)) (epg-delete-output-file context) (if (and input-file