diff options
| author | Daiki Ueno | 2011-08-08 16:11:25 +0900 |
|---|---|---|
| committer | Daiki Ueno | 2011-08-08 16:11:25 +0900 |
| commit | 0b4946c4196a6b227873c87315ebda104934ca3c (patch) | |
| tree | e11f68080dce82432e28ce01f41b61ad097701e6 | |
| parent | 588728344d5fe74ed583f764a458603913f68c31 (diff) | |
| download | emacs-0b4946c4196a6b227873c87315ebda104934ca3c.tar.gz emacs-0b4946c4196a6b227873c87315ebda104934ca3c.zip | |
Format GPG errors (bug#9255).
* epg.el (epg--status-KEYEXPIRED, epg--status-KEYREVOKED): Fix typo.
(epg-error-to-string, epg-errors-to-string): New function.
(epg-wait-for-completion): Reverse errors list.
(epg--check-error-for-decrypt, epg-sign-file, epg-sign-string)
(epg-encrypt-file, epg-encrypt-string, epg-export-keys-to-file)
(epg--import-keys-1, epg-receive-keys, epg-delete-keys)
(epg-sign-keys, epg-generate-key-from-file)
(epg-generate-key-from-string): Format errors by using
epg-errors-to-string (bug#9255).
(epg--status-INV_SGNR, epg--status-NO_SGNR): New status handler.
| -rw-r--r-- | lisp/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/epg.el | 227 |
2 files changed, 170 insertions, 70 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 52f51c918a0..d2ea294d2d0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2011-08-08 Daiki Ueno <ueno@unixuser.org> | ||
| 2 | |||
| 3 | * epg.el (epg--status-KEYEXPIRED, epg--status-KEYREVOKED): Fix typo. | ||
| 4 | (epg-error-to-string, epg-errors-to-string): New function. | ||
| 5 | (epg-wait-for-completion): Reverse errors list. | ||
| 6 | (epg--check-error-for-decrypt, epg-sign-file, epg-sign-string) | ||
| 7 | (epg-encrypt-file, epg-encrypt-string, epg-export-keys-to-file) | ||
| 8 | (epg--import-keys-1, epg-receive-keys, epg-delete-keys) | ||
| 9 | (epg-sign-keys, epg-generate-key-from-file) | ||
| 10 | (epg-generate-key-from-string): Format errors by using | ||
| 11 | epg-errors-to-string (bug#9255). | ||
| 12 | (epg--status-INV_SGNR, epg--status-NO_SGNR): New status handler. | ||
| 13 | |||
| 1 | 2011-08-07 Juri Linkov <juri@jurta.org> | 14 | 2011-08-07 Juri Linkov <juri@jurta.org> |
| 2 | 15 | ||
| 3 | * faces.el (list-faces-display): Remove extra angle bracket | 16 | * faces.el (list-faces-display): Remove extra angle bracket |
diff --git a/lisp/epg.el b/lisp/epg.el index 348ad970b14..9ca07e213b4 100644 --- a/lisp/epg.el +++ b/lisp/epg.el | |||
| @@ -1069,6 +1069,59 @@ This function is for internal use only." | |||
| 1069 | (format " secret keys unchanged: %d\n" | 1069 | (format " secret keys unchanged: %d\n" |
| 1070 | (epg-import-result-secret-unchanged import-result))))) | 1070 | (epg-import-result-secret-unchanged import-result))))) |
| 1071 | 1071 | ||
| 1072 | (defun epg-error-to-string (error) | ||
| 1073 | (cond | ||
| 1074 | ((eq (car error) 'exit) | ||
| 1075 | "Exit") | ||
| 1076 | ((eq (car error) 'quit) | ||
| 1077 | "Cancelled") | ||
| 1078 | ((eq (car error) 'no-data) | ||
| 1079 | (let ((entry (assq (cdr error) epg-no-data-reason-alist))) | ||
| 1080 | (if entry | ||
| 1081 | (format "No data (%s)" (downcase (cdr entry))) | ||
| 1082 | "No data"))) | ||
| 1083 | ((eq (car error) 'unexpected) | ||
| 1084 | (let ((entry (assq (cdr error) epg-unexpected-reason-alist))) | ||
| 1085 | (if entry | ||
| 1086 | (format "Unexpected (%s)" (downcase (cdr entry))) | ||
| 1087 | "Unexpected"))) | ||
| 1088 | ((eq (car error) 'bad-armor) | ||
| 1089 | "Bad armor") | ||
| 1090 | ((memq (car error) '(invalid-recipient invalid-signer)) | ||
| 1091 | (concat | ||
| 1092 | (if (eq (car error) 'invalid-recipient) | ||
| 1093 | "Unusable public key" | ||
| 1094 | "Unusable secret key") | ||
| 1095 | (let ((entry (assq 'requested (cdr error)))) | ||
| 1096 | (if entry | ||
| 1097 | (format ": %s" (cdr entry)) | ||
| 1098 | ": <unknown>")) | ||
| 1099 | (let ((entry (assq 'reason (cdr error)))) | ||
| 1100 | (if (and entry | ||
| 1101 | (> (cdr entry) 0) ;no specific reason given | ||
| 1102 | (setq entry (assq (cdr entry) | ||
| 1103 | epg-invalid-recipients-reason-alist))) | ||
| 1104 | (format " (%s)" (downcase (cdr entry))) | ||
| 1105 | "")))) | ||
| 1106 | ((eq (car error) 'no-pubkey) | ||
| 1107 | (format "No public key: %s" (cdr error))) | ||
| 1108 | ((eq (car error) 'no-seckey) | ||
| 1109 | (format "No secret key: %s" (cdr error))) | ||
| 1110 | ((eq (car error) 'no-recipients) | ||
| 1111 | "No recipients") | ||
| 1112 | ((eq (car error) 'no-signers) | ||
| 1113 | "No signers") | ||
| 1114 | ((eq (car error) 'delete-problem) | ||
| 1115 | (let ((entry (assq (cdr error) epg-delete-problem-reason-alist))) | ||
| 1116 | (if entry | ||
| 1117 | (format "Delete problem (%s)" (downcase (cdr entry))) | ||
| 1118 | "Delete problem"))) | ||
| 1119 | ((eq (car error) 'key-not-created) | ||
| 1120 | "Key not created"))) | ||
| 1121 | |||
| 1122 | (defun epg-errors-to-string (errors) | ||
| 1123 | (mapconcat #'epg-error-to-string errors "; ")) | ||
| 1124 | |||
| 1072 | (defun epg--start (context args) | 1125 | (defun epg--start (context args) |
| 1073 | "Start `epg-gpg-program' in a subprocess with given ARGS." | 1126 | "Start `epg-gpg-program' in a subprocess with given ARGS." |
| 1074 | (if (and (epg-context-process context) | 1127 | (if (and (epg-context-process context) |
| @@ -1195,7 +1248,7 @@ This function is for internal use only." | |||
| 1195 | (if epg-pending-status-list | 1248 | (if epg-pending-status-list |
| 1196 | (epg-context-set-result-for | 1249 | (epg-context-set-result-for |
| 1197 | context 'error | 1250 | context 'error |
| 1198 | (cons (list 'exit) | 1251 | (cons '(exit) |
| 1199 | (epg-context-result-for context 'error)))))) | 1252 | (epg-context-result-for context 'error)))))) |
| 1200 | 1253 | ||
| 1201 | (defun epg-wait-for-completion (context) | 1254 | (defun epg-wait-for-completion (context) |
| @@ -1203,7 +1256,10 @@ This function is for internal use only." | |||
| 1203 | (while (eq (process-status (epg-context-process context)) 'run) | 1256 | (while (eq (process-status (epg-context-process context)) 'run) |
| 1204 | (accept-process-output (epg-context-process context) 1)) | 1257 | (accept-process-output (epg-context-process context) 1)) |
| 1205 | ;; This line is needed to run the process-filter right now. | 1258 | ;; This line is needed to run the process-filter right now. |
| 1206 | (sleep-for 0.1)) | 1259 | (sleep-for 0.1) |
| 1260 | (epg-context-set-result-for | ||
| 1261 | context 'error | ||
| 1262 | (nreverse (epg-context-result-for context 'error)))) | ||
| 1207 | 1263 | ||
| 1208 | (defun epg-reset (context) | 1264 | (defun epg-reset (context) |
| 1209 | "Reset the CONTEXT." | 1265 | "Reset the CONTEXT." |
| @@ -1399,11 +1455,22 @@ This function is for internal use only." | |||
| 1399 | (epg--status-*SIG context 'bad string)) | 1455 | (epg--status-*SIG context 'bad string)) |
| 1400 | 1456 | ||
| 1401 | (defun epg--status-NO_PUBKEY (context string) | 1457 | (defun epg--status-NO_PUBKEY (context string) |
| 1402 | (let ((signature (car (epg-context-result-for context 'verify)))) | 1458 | (if (eq (epg-context-operation context) 'verify) |
| 1403 | (if (and signature | 1459 | (let ((signature (car (epg-context-result-for context 'verify)))) |
| 1404 | (eq (epg-signature-status signature) 'error) | 1460 | (if (and signature |
| 1405 | (equal (epg-signature-key-id signature) string)) | 1461 | (eq (epg-signature-status signature) 'error) |
| 1406 | (epg-signature-set-status signature 'no-pubkey)))) | 1462 | (equal (epg-signature-key-id signature) string)) |
| 1463 | (epg-signature-set-status signature 'no-pubkey))) | ||
| 1464 | (epg-context-set-result-for | ||
| 1465 | context 'error | ||
| 1466 | (cons (cons 'no-pubkey string) | ||
| 1467 | (epg-context-result-for context 'error))))) | ||
| 1468 | |||
| 1469 | (defun epg--status-NO_SECKEY (context string) | ||
| 1470 | (epg-context-set-result-for | ||
| 1471 | context 'error | ||
| 1472 | (cons (cons 'no-seckey string) | ||
| 1473 | (epg-context-result-for context 'error)))) | ||
| 1407 | 1474 | ||
| 1408 | (defun epg--time-from-seconds (seconds) | 1475 | (defun epg--time-from-seconds (seconds) |
| 1409 | (let ((number-seconds (string-to-number (concat seconds ".0")))) | 1476 | (let ((number-seconds (string-to-number (concat seconds ".0")))) |
| @@ -1564,13 +1631,13 @@ This function is for internal use only." | |||
| 1564 | context 'key | 1631 | context 'key |
| 1565 | (cons (list 'key-expired (cons 'expiration-time | 1632 | (cons (list 'key-expired (cons 'expiration-time |
| 1566 | (epg--time-from-seconds string))) | 1633 | (epg--time-from-seconds string))) |
| 1567 | (epg-context-result-for context 'error)))) | 1634 | (epg-context-result-for context 'key)))) |
| 1568 | 1635 | ||
| 1569 | (defun epg--status-KEYREVOKED (context _string) | 1636 | (defun epg--status-KEYREVOKED (context _string) |
| 1570 | (epg-context-set-result-for | 1637 | (epg-context-set-result-for |
| 1571 | context 'key | 1638 | context 'key |
| 1572 | (cons '(key-revoked) | 1639 | (cons '(key-revoked) |
| 1573 | (epg-context-result-for context 'error)))) | 1640 | (epg-context-result-for context 'key)))) |
| 1574 | 1641 | ||
| 1575 | (defun epg--status-BADARMOR (context _string) | 1642 | (defun epg--status-BADARMOR (context _string) |
| 1576 | (epg-context-set-result-for | 1643 | (epg-context-set-result-for |
| @@ -1585,7 +1652,18 @@ This function is for internal use only." | |||
| 1585 | (cons (list 'invalid-recipient | 1652 | (cons (list 'invalid-recipient |
| 1586 | (cons 'reason | 1653 | (cons 'reason |
| 1587 | (string-to-number (match-string 1 string))) | 1654 | (string-to-number (match-string 1 string))) |
| 1588 | (cons 'requested-recipient | 1655 | (cons 'requested |
| 1656 | (match-string 2 string))) | ||
| 1657 | (epg-context-result-for context 'error))))) | ||
| 1658 | |||
| 1659 | (defun epg--status-INV_SGNR (context string) | ||
| 1660 | (if (string-match "\\`\\([0-9]+\\) \\(.*\\)" string) | ||
| 1661 | (epg-context-set-result-for | ||
| 1662 | context 'error | ||
| 1663 | (cons (list 'invalid-signer | ||
| 1664 | (cons 'reason | ||
| 1665 | (string-to-number (match-string 1 string))) | ||
| 1666 | (cons 'requested | ||
| 1589 | (match-string 2 string))) | 1667 | (match-string 2 string))) |
| 1590 | (epg-context-result-for context 'error))))) | 1668 | (epg-context-result-for context 'error))))) |
| 1591 | 1669 | ||
| @@ -1595,6 +1673,12 @@ This function is for internal use only." | |||
| 1595 | (cons '(no-recipients) | 1673 | (cons '(no-recipients) |
| 1596 | (epg-context-result-for context 'error)))) | 1674 | (epg-context-result-for context 'error)))) |
| 1597 | 1675 | ||
| 1676 | (defun epg--status-NO_SGNR (context _string) | ||
| 1677 | (epg-context-set-result-for | ||
| 1678 | context 'error | ||
| 1679 | (cons '(no-signers) | ||
| 1680 | (epg-context-result-for context 'error)))) | ||
| 1681 | |||
| 1598 | (defun epg--status-DELETE_PROBLEM (context string) | 1682 | (defun epg--status-DELETE_PROBLEM (context string) |
| 1599 | (if (string-match "\\`\\([0-9]+\\)" string) | 1683 | (if (string-match "\\`\\([0-9]+\\)" string) |
| 1600 | (epg-context-set-result-for | 1684 | (epg-context-set-result-for |
| @@ -1960,17 +2044,13 @@ If you are unsure, use synchronous version of this function | |||
| 1960 | (epg-wait-for-status context '("BEGIN_DECRYPTION")))) | 2044 | (epg-wait-for-status context '("BEGIN_DECRYPTION")))) |
| 1961 | 2045 | ||
| 1962 | (defun epg--check-error-for-decrypt (context) | 2046 | (defun epg--check-error-for-decrypt (context) |
| 1963 | (if (epg-context-result-for context 'decryption-failed) | 2047 | (let ((errors (epg-context-result-for context 'error))) |
| 1964 | (signal 'epg-error (list "Decryption failed"))) | 2048 | (if (epg-context-result-for context 'decryption-failed) |
| 1965 | (if (epg-context-result-for context 'no-secret-key) | 2049 | (signal 'epg-error |
| 1966 | (signal 'epg-error | 2050 | (list "Decryption failed" (epg-errors-to-string errors)))) |
| 1967 | (list "No secret key" | ||
| 1968 | (epg-context-result-for context 'no-secret-key)))) | ||
| 1969 | (unless (epg-context-result-for context 'decryption-okay) | 2051 | (unless (epg-context-result-for context 'decryption-okay) |
| 1970 | (let* ((error (epg-context-result-for context 'error))) | 2052 | (signal 'epg-error |
| 1971 | (if (assq 'no-data error) | 2053 | (list "Can't decrypt" (epg-errors-to-string errors)))))) |
| 1972 | (signal 'epg-error (list "No data"))) | ||
| 1973 | (signal 'epg-error (list "Can't decrypt" error))))) | ||
| 1974 | 2054 | ||
| 1975 | (defun epg-decrypt-file (context cipher plain) | 2055 | (defun epg-decrypt-file (context cipher plain) |
| 1976 | "Decrypt a file CIPHER and store the result to a file PLAIN. | 2056 | "Decrypt a file CIPHER and store the result to a file PLAIN. |
| @@ -2165,10 +2245,9 @@ Otherwise, it makes a cleartext signature." | |||
| 2165 | (epg-start-sign context (epg-make-data-from-file plain) mode) | 2245 | (epg-start-sign context (epg-make-data-from-file plain) mode) |
| 2166 | (epg-wait-for-completion context) | 2246 | (epg-wait-for-completion context) |
| 2167 | (unless (epg-context-result-for context 'sign) | 2247 | (unless (epg-context-result-for context 'sign) |
| 2168 | (if (epg-context-result-for context 'error) | 2248 | (let ((errors (epg-context-result-for context 'error))) |
| 2169 | (error "Sign failed: %S" | 2249 | (signal 'epg-error |
| 2170 | (epg-context-result-for context 'error)) | 2250 | (list "Sign failed" (epg-errors-to-string errors))))) |
| 2171 | (error "Sign failed"))) | ||
| 2172 | (unless signature | 2251 | (unless signature |
| 2173 | (epg-read-output context))) | 2252 | (epg-read-output context))) |
| 2174 | (unless signature | 2253 | (unless signature |
| @@ -2203,9 +2282,9 @@ Otherwise, it makes a cleartext signature." | |||
| 2203 | (epg-wait-for-completion context) | 2282 | (epg-wait-for-completion context) |
| 2204 | (unless (epg-context-result-for context 'sign) | 2283 | (unless (epg-context-result-for context 'sign) |
| 2205 | (if (epg-context-result-for context 'error) | 2284 | (if (epg-context-result-for context 'error) |
| 2206 | (error "Sign failed: %S" | 2285 | (let ((errors (epg-context-result-for context 'error))) |
| 2207 | (epg-context-result-for context 'error)) | 2286 | (signal 'epg-error |
| 2208 | (error "Sign failed"))) | 2287 | (list "Sign failed" (epg-errors-to-string errors)))))) |
| 2209 | (epg-read-output context)) | 2288 | (epg-read-output context)) |
| 2210 | (epg-delete-output-file context) | 2289 | (epg-delete-output-file context) |
| 2211 | (if input-file | 2290 | (if input-file |
| @@ -2276,15 +2355,14 @@ If RECIPIENTS is nil, it performs symmetric encryption." | |||
| 2276 | (epg-start-encrypt context (epg-make-data-from-file plain) | 2355 | (epg-start-encrypt context (epg-make-data-from-file plain) |
| 2277 | recipients sign always-trust) | 2356 | recipients sign always-trust) |
| 2278 | (epg-wait-for-completion context) | 2357 | (epg-wait-for-completion context) |
| 2279 | (if (and sign | 2358 | (let ((errors (epg-context-result-for context 'error))) |
| 2280 | (not (epg-context-result-for context 'sign))) | 2359 | (if (and sign |
| 2281 | (if (epg-context-result-for context 'error) | 2360 | (not (epg-context-result-for context 'sign))) |
| 2282 | (error "Sign failed: %S" | 2361 | (signal 'epg-error |
| 2283 | (epg-context-result-for context 'error)) | 2362 | (list "Sign failed" (epg-errors-to-string errors)))) |
| 2284 | (error "Sign failed"))) | 2363 | (if errors |
| 2285 | (if (epg-context-result-for context 'error) | 2364 | (signal 'epg-error |
| 2286 | (error "Encrypt failed: %S" | 2365 | (list "Encrypt failed" (epg-errors-to-string errors))))) |
| 2287 | (epg-context-result-for context 'error))) | ||
| 2288 | (unless cipher | 2366 | (unless cipher |
| 2289 | (epg-read-output context))) | 2367 | (epg-read-output context))) |
| 2290 | (unless cipher | 2368 | (unless cipher |
| @@ -2317,15 +2395,14 @@ If RECIPIENTS is nil, it performs symmetric encryption." | |||
| 2317 | (epg-make-data-from-string plain)) | 2395 | (epg-make-data-from-string plain)) |
| 2318 | recipients sign always-trust) | 2396 | recipients sign always-trust) |
| 2319 | (epg-wait-for-completion context) | 2397 | (epg-wait-for-completion context) |
| 2320 | (if (and sign | 2398 | (let ((errors (epg-context-result-for context 'error))) |
| 2321 | (not (epg-context-result-for context 'sign))) | 2399 | (if (and sign |
| 2322 | (if (epg-context-result-for context 'error) | 2400 | (not (epg-context-result-for context 'sign))) |
| 2323 | (error "Sign failed: %S" | 2401 | (signal 'epg-error |
| 2324 | (epg-context-result-for context 'error)) | 2402 | (list "Sign failed" (epg-errors-to-string errors)))) |
| 2325 | (error "Sign failed"))) | 2403 | (if errors |
| 2326 | (if (epg-context-result-for context 'error) | 2404 | (signal 'epg-error |
| 2327 | (error "Encrypt failed: %S" | 2405 | (list "Encrypt failed" (epg-errors-to-string errors))))) |
| 2328 | (epg-context-result-for context 'error))) | ||
| 2329 | (epg-read-output context)) | 2406 | (epg-read-output context)) |
| 2330 | (epg-delete-output-file context) | 2407 | (epg-delete-output-file context) |
| 2331 | (if input-file | 2408 | (if input-file |
| @@ -2359,9 +2436,11 @@ If you are unsure, use synchronous version of this function | |||
| 2359 | (epg--make-temp-file "epg-output"))) | 2436 | (epg--make-temp-file "epg-output"))) |
| 2360 | (epg-start-export-keys context keys) | 2437 | (epg-start-export-keys context keys) |
| 2361 | (epg-wait-for-completion context) | 2438 | (epg-wait-for-completion context) |
| 2362 | (if (epg-context-result-for context 'error) | 2439 | (let ((errors (epg-context-result-for context 'error))) |
| 2363 | (error "Export keys failed: %S" | 2440 | (if errors |
| 2364 | (epg-context-result-for context 'error))) | 2441 | (signal 'epg-error |
| 2442 | (list "Export keys failed" | ||
| 2443 | (epg-errors-to-string errors))))) | ||
| 2365 | (unless file | 2444 | (unless file |
| 2366 | (epg-read-output context))) | 2445 | (epg-read-output context))) |
| 2367 | (unless file | 2446 | (unless file |
| @@ -2398,9 +2477,11 @@ If you are unsure, use synchronous version of this function | |||
| 2398 | (progn | 2477 | (progn |
| 2399 | (epg-start-import-keys context keys) | 2478 | (epg-start-import-keys context keys) |
| 2400 | (epg-wait-for-completion context) | 2479 | (epg-wait-for-completion context) |
| 2401 | (if (epg-context-result-for context 'error) | 2480 | (let ((errors (epg-context-result-for context 'error))) |
| 2402 | (error "Import keys failed: %S" | 2481 | (if errors |
| 2403 | (epg-context-result-for context 'error)))) | 2482 | (signal 'epg-error |
| 2483 | (list "Import keys failed" | ||
| 2484 | (epg-errors-to-string errors)))))) | ||
| 2404 | (epg-reset context))) | 2485 | (epg-reset context))) |
| 2405 | 2486 | ||
| 2406 | (defun epg-import-keys-from-file (context keys) | 2487 | (defun epg-import-keys-from-file (context keys) |
| @@ -2431,9 +2512,11 @@ KEYS is a list of key IDs" | |||
| 2431 | (progn | 2512 | (progn |
| 2432 | (epg-start-receive-keys context keys) | 2513 | (epg-start-receive-keys context keys) |
| 2433 | (epg-wait-for-completion context) | 2514 | (epg-wait-for-completion context) |
| 2434 | (if (epg-context-result-for context 'error) | 2515 | (let ((errors (epg-context-result-for context 'error))) |
| 2435 | (error "Receive keys failed: %S" | 2516 | (if errors |
| 2436 | (epg-context-result-for context 'error)))) | 2517 | (signal 'epg-error |
| 2518 | (list "Receive keys failed" | ||
| 2519 | (epg-errors-to-string errors)))))) | ||
| 2437 | (epg-reset context))) | 2520 | (epg-reset context))) |
| 2438 | 2521 | ||
| 2439 | (defalias 'epg-import-keys-from-server 'epg-receive-keys) | 2522 | (defalias 'epg-import-keys-from-server 'epg-receive-keys) |
| @@ -2463,13 +2546,11 @@ If you are unsure, use synchronous version of this function | |||
| 2463 | (progn | 2546 | (progn |
| 2464 | (epg-start-delete-keys context keys allow-secret) | 2547 | (epg-start-delete-keys context keys allow-secret) |
| 2465 | (epg-wait-for-completion context) | 2548 | (epg-wait-for-completion context) |
| 2466 | (let ((entry (assq 'delete-problem | 2549 | (let ((errors (epg-context-result-for context 'error))) |
| 2467 | (epg-context-result-for context 'error)))) | 2550 | (if errors |
| 2468 | (if entry | 2551 | (signal 'epg-error |
| 2469 | (if (setq entry (assq (cdr entry) | 2552 | (list "Delete keys failed" |
| 2470 | epg-delete-problem-reason-alist)) | 2553 | (epg-errors-to-string errors)))))) |
| 2471 | (error "Delete keys failed: %s" (cdr entry)) | ||
| 2472 | (error "Delete keys failed"))))) | ||
| 2473 | (epg-reset context))) | 2554 | (epg-reset context))) |
| 2474 | 2555 | ||
| 2475 | (defun epg-start-sign-keys (context keys &optional local) | 2556 | (defun epg-start-sign-keys (context keys &optional local) |
| @@ -2498,9 +2579,11 @@ If you are unsure, use synchronous version of this function | |||
| 2498 | (progn | 2579 | (progn |
| 2499 | (epg-start-sign-keys context keys local) | 2580 | (epg-start-sign-keys context keys local) |
| 2500 | (epg-wait-for-completion context) | 2581 | (epg-wait-for-completion context) |
| 2501 | (if (epg-context-result-for context 'error) | 2582 | (let ((errors (epg-context-result-for context 'error))) |
| 2502 | (error "Sign keys failed: %S" | 2583 | (if errors |
| 2503 | (epg-context-result-for context 'error)))) | 2584 | (signal 'epg-error |
| 2585 | (list "Sign keys failed" | ||
| 2586 | (epg-errors-to-string errors)))))) | ||
| 2504 | (epg-reset context))) | 2587 | (epg-reset context))) |
| 2505 | (make-obsolete 'epg-sign-keys "do not use." "23.1") | 2588 | (make-obsolete 'epg-sign-keys "do not use." "23.1") |
| 2506 | 2589 | ||
| @@ -2532,9 +2615,11 @@ PARAMETERS is a file which tells how to create the key." | |||
| 2532 | (progn | 2615 | (progn |
| 2533 | (epg-start-generate-key context (epg-make-data-from-file parameters)) | 2616 | (epg-start-generate-key context (epg-make-data-from-file parameters)) |
| 2534 | (epg-wait-for-completion context) | 2617 | (epg-wait-for-completion context) |
| 2535 | (if (epg-context-result-for context 'error) | 2618 | (let ((errors (epg-context-result-for context 'error))) |
| 2536 | (error "Generate key failed: %S" | 2619 | (if errors |
| 2537 | (epg-context-result-for context 'error)))) | 2620 | (signal 'epg-error |
| 2621 | (list "Generate key failed" | ||
| 2622 | (epg-errors-to-string errors)))))) | ||
| 2538 | (epg-reset context))) | 2623 | (epg-reset context))) |
| 2539 | 2624 | ||
| 2540 | (defun epg-generate-key-from-string (context parameters) | 2625 | (defun epg-generate-key-from-string (context parameters) |
| @@ -2544,9 +2629,11 @@ PARAMETERS is a string which tells how to create the key." | |||
| 2544 | (progn | 2629 | (progn |
| 2545 | (epg-start-generate-key context (epg-make-data-from-string parameters)) | 2630 | (epg-start-generate-key context (epg-make-data-from-string parameters)) |
| 2546 | (epg-wait-for-completion context) | 2631 | (epg-wait-for-completion context) |
| 2547 | (if (epg-context-result-for context 'error) | 2632 | (let ((errors (epg-context-result-for context 'error))) |
| 2548 | (error "Generate key failed: %S" | 2633 | (if errors |
| 2549 | (epg-context-result-for context 'error)))) | 2634 | (signal 'epg-error |
| 2635 | (list "Generate key failed" | ||
| 2636 | (epg-errors-to-string errors)))))) | ||
| 2550 | (epg-reset context))) | 2637 | (epg-reset context))) |
| 2551 | 2638 | ||
| 2552 | (defun epg--decode-percent-escape (string) | 2639 | (defun epg--decode-percent-escape (string) |