diff options
| author | Stefan Monnier | 2014-10-23 17:38:56 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2014-10-23 17:38:56 -0400 |
| commit | e77628bd580fe5a1345306a75853704b0b0d557c (patch) | |
| tree | a16bf31badd48ee7149902774f8a8aacee11e9ca | |
| parent | 19625efbcb2cf4f9807a33801a91f16f02c2e930 (diff) | |
| download | emacs-e77628bd580fe5a1345306a75853704b0b0d557c.tar.gz emacs-e77628bd580fe5a1345306a75853704b0b0d557c.zip | |
* lisp/epg.el: Use cl-defstruct.
(epg-make-data-from-file, epg-make-data-from-string, epg-data-file)
(epg-data-string): Define via cl-defstruct.
(epg--gv-nreverse): New macro.
(epg-context--make): New constructor (provided vi cl-defstruct).
(epg-make-context): Rewrite using it.
(epg-context-protocol, epg-context-program)
(epg-context-home-directory, epg-context-armor, epg-context-textmode)
(epg-context-include-certs, epg-context-cipher-algorithm)
(epg-context-digest-algorithm, epg-context-compress-algorithm)
(epg-context-passphrase-callback, epg-context-progress-callback)
(epg-context-signers, epg-context-sig-notations, epg-context-process)
(epg-context-output-file, epg-context-result, epg-context-operation)
(epg-context-pinentry-mode): Define using cl-defstruct.
(epg-context-set-protocol, epg-context-set-program)
(epg-context-set-include-certs, epg-context-set-cipher-algorithm)
(epg-context-set-digest-algorithm)
(epg-context-set-sig-notations, epg-context-set-process)
(epg-context-set-output-file, epg-context-set-result)
(epg-context-set-operation, epg-context-set-pinentry-mode)
(epg-context-set-compress-algorithm): Remove. Use setf instead.
(epg-context-set-armor, epg-context-set-textmode)
(epg-context-set-signers): Redefine using setf
and declare as obsolete.
(epg-context-set-passphrase-callback)
(epg-context-set-progress-callback): Use setf.
(epg-signature-notations): Rename from epg-sig-notations.
(epg-make-signature, epg-signature-status, epg-signature-key-id)
(epg-signature-validity, epg-signature-fingerprint)
(epg-signature-creation-time, epg-signature-expiration-time)
(epg-signature-pubkey-algorithm, epg-signature-digest-algorithm)
(epg-signature-class, epg-signature-version): Define vi cl-defstruct.
(epg-signature-set-status, epg-signature-set-key-id)
(epg-signature-set-validity, epg-signature-set-fingerprint)
(epg-signature-set-creation-time, epg-signature-set-expiration-time)
(epg-signature-set-pubkey-algorithm)
(epg-signature-set-digest-algorithm, epg-signature-set-class)
(epg-signature-set-version, epg-signature-set-notations): Remove.
Use setf instead.
(epg-make-new-signature, epg-new-signature-type)
(epg-new-signature-pubkey-algorithm)
(epg-new-signature-digest-algorithm, epg-new-signature-class)
(epg-new-signature-creation-time, epg-new-signature-fingerprint):
Define using cl-defstruct.
(epg-make-key, epg-key-owner-trust, epg-key-sub-key-list)
(epg-key-user-id-list): Define using cl-defstruct.
(epg-key-set-sub-key-list, epg-key-set-user-id-list): Remove.
Use setf instead.
(epg-make-sub-key, epg-sub-key-validity, epg-sub-key-capability)
(epg-sub-key-secret-p, epg-sub-key-algorithm, epg-sub-key-length)
(epg-sub-key-id, epg-sub-key-creation-time)
(epg-sub-key-expiration-time, epg-sub-key-fingerprint): Define using
cl-defstruct.
(epg-sub-key-set-fingerprint): Remove. Use setf instead.
(epg-make-user-id, epg-user-id-validity, epg-user-id-string)
(epg-user-id-signature-list): Define using cl-defstruct.
(epg-user-id-set-signature-list): Remove. Use setf instead.
(epg-make-key-signature, epg-key-signature-validity)
(epg-key-signature-pubkey-algorithm, epg-key-signature-key-id)
(epg-key-signature-creation-time, epg-key-signature-expiration-time)
(epg-key-signature-user-id, epg-key-signature-class)
(epg-key-signature-exportable-p): Define using cl-defstruct.
(epg-make-sig-notation, epg-sig-notation-name)
(epg-sig-notation-value, epg-sig-notation-human-readable)
(epg-sig-notation-critical): Define using cl-defstruct.
(epg-sig-notation-set-value): Remove. Use setf instead.
(epg-make-import-status, epg-import-status-fingerprint)
(epg-import-status-reason, epg-import-status-new)
(epg-import-status-user-id, epg-import-status-signature)
(epg-import-status-sub-key, epg-import-status-secret): Define using
cl-defstruct.
(epg-make-import-result, epg-import-result-considered)
(epg-import-result-no-user-id, epg-import-result-imported)
(epg-import-result-imported-rsa, epg-import-result-unchanged)
(epg-import-result-new-user-ids, epg-import-result-new-sub-keys)
(epg-import-result-new-signatures, epg-import-result-new-revocations)
(epg-import-result-secret-read, epg-import-result-secret-imported)
(epg-import-result-secret-unchanged, epg-import-result-not-imported)
(epg-import-result-imports): Define using cl-defstruct.
* lisp/emacs-lisp/package.el: Require EPG during macroexpansion.
(package--check-signature, package-import-keyring): Use setf instead of
epg-context-set-home-directory.
| -rw-r--r-- | lisp/ChangeLog | 86 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 6 | ||||
| -rw-r--r-- | lisp/epg.el | 1228 |
3 files changed, 371 insertions, 949 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 722711d16fb..7c5b1ac06a0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,91 @@ | |||
| 1 | 2014-10-23 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2014-10-23 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * epg.el: Use cl-defstruct. | ||
| 4 | (epg-make-data-from-file, epg-make-data-from-string, epg-data-file) | ||
| 5 | (epg-data-string): Define via cl-defstruct. | ||
| 6 | (epg--gv-nreverse): New macro. | ||
| 7 | (epg-context--make): New constructor (provided vi cl-defstruct). | ||
| 8 | (epg-make-context): Rewrite using it. | ||
| 9 | (epg-context-protocol, epg-context-program) | ||
| 10 | (epg-context-home-directory, epg-context-armor, epg-context-textmode) | ||
| 11 | (epg-context-include-certs, epg-context-cipher-algorithm) | ||
| 12 | (epg-context-digest-algorithm, epg-context-compress-algorithm) | ||
| 13 | (epg-context-passphrase-callback, epg-context-progress-callback) | ||
| 14 | (epg-context-signers, epg-context-sig-notations, epg-context-process) | ||
| 15 | (epg-context-output-file, epg-context-result, epg-context-operation) | ||
| 16 | (epg-context-pinentry-mode): Define using cl-defstruct. | ||
| 17 | (epg-context-set-protocol, epg-context-set-program) | ||
| 18 | (epg-context-set-include-certs, epg-context-set-cipher-algorithm) | ||
| 19 | (epg-context-set-digest-algorithm) | ||
| 20 | (epg-context-set-sig-notations, epg-context-set-process) | ||
| 21 | (epg-context-set-output-file, epg-context-set-result) | ||
| 22 | (epg-context-set-operation, epg-context-set-pinentry-mode) | ||
| 23 | (epg-context-set-compress-algorithm): Remove. Use setf instead. | ||
| 24 | (epg-context-set-armor, epg-context-set-textmode) | ||
| 25 | (epg-context-set-signers): Redefine using setf | ||
| 26 | and declare as obsolete. | ||
| 27 | (epg-context-set-passphrase-callback) | ||
| 28 | (epg-context-set-progress-callback): Use setf. | ||
| 29 | (epg-signature-notations): Rename from epg-sig-notations. | ||
| 30 | (epg-make-signature, epg-signature-status, epg-signature-key-id) | ||
| 31 | (epg-signature-validity, epg-signature-fingerprint) | ||
| 32 | (epg-signature-creation-time, epg-signature-expiration-time) | ||
| 33 | (epg-signature-pubkey-algorithm, epg-signature-digest-algorithm) | ||
| 34 | (epg-signature-class, epg-signature-version): Define vi cl-defstruct. | ||
| 35 | (epg-signature-set-status, epg-signature-set-key-id) | ||
| 36 | (epg-signature-set-validity, epg-signature-set-fingerprint) | ||
| 37 | (epg-signature-set-creation-time, epg-signature-set-expiration-time) | ||
| 38 | (epg-signature-set-pubkey-algorithm) | ||
| 39 | (epg-signature-set-digest-algorithm, epg-signature-set-class) | ||
| 40 | (epg-signature-set-version, epg-signature-set-notations): Remove. | ||
| 41 | Use setf instead. | ||
| 42 | (epg-make-new-signature, epg-new-signature-type) | ||
| 43 | (epg-new-signature-pubkey-algorithm) | ||
| 44 | (epg-new-signature-digest-algorithm, epg-new-signature-class) | ||
| 45 | (epg-new-signature-creation-time, epg-new-signature-fingerprint): | ||
| 46 | Define using cl-defstruct. | ||
| 47 | (epg-make-key, epg-key-owner-trust, epg-key-sub-key-list) | ||
| 48 | (epg-key-user-id-list): Define using cl-defstruct. | ||
| 49 | (epg-key-set-sub-key-list, epg-key-set-user-id-list): Remove. | ||
| 50 | Use setf instead. | ||
| 51 | (epg-make-sub-key, epg-sub-key-validity, epg-sub-key-capability) | ||
| 52 | (epg-sub-key-secret-p, epg-sub-key-algorithm, epg-sub-key-length) | ||
| 53 | (epg-sub-key-id, epg-sub-key-creation-time) | ||
| 54 | (epg-sub-key-expiration-time, epg-sub-key-fingerprint): Define using | ||
| 55 | cl-defstruct. | ||
| 56 | (epg-sub-key-set-fingerprint): Remove. Use setf instead. | ||
| 57 | (epg-make-user-id, epg-user-id-validity, epg-user-id-string) | ||
| 58 | (epg-user-id-signature-list): Define using cl-defstruct. | ||
| 59 | (epg-user-id-set-signature-list): Remove. Use setf instead. | ||
| 60 | (epg-make-key-signature, epg-key-signature-validity) | ||
| 61 | (epg-key-signature-pubkey-algorithm, epg-key-signature-key-id) | ||
| 62 | (epg-key-signature-creation-time, epg-key-signature-expiration-time) | ||
| 63 | (epg-key-signature-user-id, epg-key-signature-class) | ||
| 64 | (epg-key-signature-exportable-p): Define using cl-defstruct. | ||
| 65 | (epg-make-sig-notation, epg-sig-notation-name) | ||
| 66 | (epg-sig-notation-value, epg-sig-notation-human-readable) | ||
| 67 | (epg-sig-notation-critical): Define using cl-defstruct. | ||
| 68 | (epg-sig-notation-set-value): Remove. Use setf instead. | ||
| 69 | (epg-make-import-status, epg-import-status-fingerprint) | ||
| 70 | (epg-import-status-reason, epg-import-status-new) | ||
| 71 | (epg-import-status-user-id, epg-import-status-signature) | ||
| 72 | (epg-import-status-sub-key, epg-import-status-secret): Define using | ||
| 73 | cl-defstruct. | ||
| 74 | (epg-make-import-result, epg-import-result-considered) | ||
| 75 | (epg-import-result-no-user-id, epg-import-result-imported) | ||
| 76 | (epg-import-result-imported-rsa, epg-import-result-unchanged) | ||
| 77 | (epg-import-result-new-user-ids, epg-import-result-new-sub-keys) | ||
| 78 | (epg-import-result-new-signatures, epg-import-result-new-revocations) | ||
| 79 | (epg-import-result-secret-read, epg-import-result-secret-imported) | ||
| 80 | (epg-import-result-secret-unchanged, epg-import-result-not-imported) | ||
| 81 | (epg-import-result-imports): Define using cl-defstruct. | ||
| 82 | |||
| 83 | * emacs-lisp/package.el: Require EPG during macroexpansion. | ||
| 84 | (package--check-signature, package-import-keyring): Use setf instead of | ||
| 85 | epg-context-set-home-directory. | ||
| 86 | |||
| 87 | 2014-10-23 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 88 | |||
| 3 | * emacs-lisp/bytecomp.el (byte-compile--use-old-handlers): Change default. | 89 | * emacs-lisp/bytecomp.el (byte-compile--use-old-handlers): Change default. |
| 4 | 90 | ||
| 5 | 2014-10-23 Leo Liu <sdl.web@gmail.com> | 91 | 2014-10-23 Leo Liu <sdl.web@gmail.com> |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 10944f81534..b8370fde337 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -162,6 +162,7 @@ | |||
| 162 | ;;; Code: | 162 | ;;; Code: |
| 163 | 163 | ||
| 164 | (eval-when-compile (require 'cl-lib)) | 164 | (eval-when-compile (require 'cl-lib)) |
| 165 | (eval-when-compile (require 'epg)) ;For setf accessors. | ||
| 165 | 166 | ||
| 166 | (require 'tabulated-list) | 167 | (require 'tabulated-list) |
| 167 | 168 | ||
| @@ -809,7 +810,6 @@ buffer is killed afterwards. Return the last value in BODY." | |||
| 809 | cipher-algorithm | 810 | cipher-algorithm |
| 810 | digest-algorithm | 811 | digest-algorithm |
| 811 | compress-algorithm)) | 812 | compress-algorithm)) |
| 812 | (declare-function epg-context-set-home-directory "epg" (context directory)) | ||
| 813 | (declare-function epg-verify-string "epg" (context signature | 813 | (declare-function epg-verify-string "epg" (context signature |
| 814 | &optional signed-text)) | 814 | &optional signed-text)) |
| 815 | (declare-function epg-context-result-for "epg" (context name)) | 815 | (declare-function epg-context-result-for "epg" (context name)) |
| @@ -824,7 +824,7 @@ GnuPG keyring is located under \"gnupg\" in `package-user-dir'." | |||
| 824 | (sig-file (concat file ".sig")) | 824 | (sig-file (concat file ".sig")) |
| 825 | (sig-content (package--with-work-buffer location sig-file | 825 | (sig-content (package--with-work-buffer location sig-file |
| 826 | (buffer-string)))) | 826 | (buffer-string)))) |
| 827 | (epg-context-set-home-directory context homedir) | 827 | (setf (epg-context-home-directory context) homedir) |
| 828 | (epg-verify-string context sig-content (buffer-string)) | 828 | (epg-verify-string context sig-content (buffer-string)) |
| 829 | (let (good-signatures had-fatal-error) | 829 | (let (good-signatures had-fatal-error) |
| 830 | ;; The .sig file may contain multiple signatures. Success if one | 830 | ;; The .sig file may contain multiple signatures. Success if one |
| @@ -1303,7 +1303,7 @@ similar to an entry in `package-alist'. Save the cached copy to | |||
| 1303 | (homedir (expand-file-name "gnupg" package-user-dir))) | 1303 | (homedir (expand-file-name "gnupg" package-user-dir))) |
| 1304 | (with-file-modes 448 | 1304 | (with-file-modes 448 |
| 1305 | (make-directory homedir t)) | 1305 | (make-directory homedir t)) |
| 1306 | (epg-context-set-home-directory context homedir) | 1306 | (setf (epg-context-home-directory context) homedir) |
| 1307 | (message "Importing %s..." (file-name-nondirectory file)) | 1307 | (message "Importing %s..." (file-name-nondirectory file)) |
| 1308 | (epg-import-keys-from-file context file) | 1308 | (epg-import-keys-from-file context file) |
| 1309 | (message "Importing %s...done" (file-name-nondirectory file)))) | 1309 | (message "Importing %s...done" (file-name-nondirectory file)))) |
diff --git a/lisp/epg.el b/lisp/epg.el index 26e3b3d2501..8b80de6295a 100644 --- a/lisp/epg.el +++ b/lisp/epg.el | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | ;;; Code: | 23 | ;;; Code: |
| 24 | 24 | ||
| 25 | (require 'epg-config) | 25 | (require 'epg-config) |
| 26 | (eval-when-compile (require 'cl-lib)) | ||
| 26 | 27 | ||
| 27 | (defvar epg-user-id nil | 28 | (defvar epg-user-id nil |
| 28 | "GnuPG ID of your default identity.") | 29 | "GnuPG ID of your default identity.") |
| @@ -164,210 +165,73 @@ | |||
| 164 | 165 | ||
| 165 | (define-error 'epg-error "GPG error") | 166 | (define-error 'epg-error "GPG error") |
| 166 | 167 | ||
| 167 | (defun epg-make-data-from-file (file) | 168 | (cl-defstruct (epg-data |
| 168 | "Make a data object from FILE." | 169 | (:constructor nil) |
| 169 | (cons 'epg-data (vector file nil))) | 170 | (:constructor epg-make-data-from-file (file)) |
| 170 | 171 | (:constructor epg-make-data-from-string (string)) | |
| 171 | (defun epg-make-data-from-string (string) | 172 | (:copier nil) |
| 172 | "Make a data object from STRING." | 173 | (:predicate nil)) |
| 173 | (cons 'epg-data (vector nil string))) | 174 | (file nil :read-only t) |
| 174 | 175 | (string nil :read-only t)) | |
| 175 | (defun epg-data-file (data) | 176 | |
| 176 | "Return the file of DATA." | 177 | (defmacro epg--gv-nreverse (place) |
| 177 | (unless (eq (car-safe data) 'epg-data) | 178 | (gv-letplace (getter setter) place |
| 178 | (signal 'wrong-type-argument (list 'epg-data-p data))) | 179 | (funcall setter `(nreverse ,getter)))) |
| 179 | (aref (cdr data) 0)) | 180 | |
| 180 | 181 | (cl-defstruct (epg-context | |
| 181 | (defun epg-data-string (data) | 182 | (:constructor nil) |
| 182 | "Return the string of DATA." | 183 | (:constructor epg-context--make |
| 183 | (unless (eq (car-safe data) 'epg-data) | 184 | (protocol &optional armor textmode include-certs |
| 184 | (signal 'wrong-type-argument (list 'epg-data-p data))) | 185 | cipher-algorithm digest-algorithm |
| 185 | (aref (cdr data) 1)) | 186 | compress-algorithm |
| 186 | 187 | &aux | |
| 188 | (program | ||
| 189 | (pcase protocol | ||
| 190 | (`OpenPGP epg-gpg-program) | ||
| 191 | (`CMS epg-gpgsm-program) | ||
| 192 | (_ (signal 'epg-error | ||
| 193 | (list "unknown protocol" protocol))))))) | ||
| 194 | (:copier nil) | ||
| 195 | (:predicate nil)) | ||
| 196 | protocol | ||
| 197 | program | ||
| 198 | (home-directory epg-gpg-home-directory) | ||
| 199 | armor | ||
| 200 | textmode | ||
| 201 | include-certs | ||
| 202 | cipher-algorithm | ||
| 203 | digest-algorithm | ||
| 204 | compress-algorithm | ||
| 205 | (passphrase-callback (list #'epg-passphrase-callback-function)) | ||
| 206 | progress-callback | ||
| 207 | signers | ||
| 208 | sig-notations | ||
| 209 | process | ||
| 210 | output-file | ||
| 211 | result | ||
| 212 | operation | ||
| 213 | pinentry-mode) | ||
| 214 | |||
| 215 | ;; This is not an alias, just so we can mark it as autoloaded. | ||
| 187 | ;;;###autoload | 216 | ;;;###autoload |
| 188 | (defun epg-make-context (&optional protocol armor textmode include-certs | 217 | (defun epg-make-context (&optional protocol armor textmode include-certs |
| 189 | cipher-algorithm digest-algorithm | 218 | cipher-algorithm digest-algorithm |
| 190 | compress-algorithm) | 219 | compress-algorithm) |
| 191 | "Return a context object." | 220 | "Return a context object." |
| 192 | (unless protocol | 221 | (epg-context--make (or protocol 'OpenPGP) |
| 193 | (setq protocol 'OpenPGP)) | 222 | armor textmode include-certs |
| 194 | (unless (memq protocol '(OpenPGP CMS)) | 223 | cipher-algorithm digest-algorithm |
| 195 | (signal 'epg-error (list "unknown protocol" protocol))) | 224 | compress-algorithm)) |
| 196 | (cons 'epg-context | ||
| 197 | (vector protocol | ||
| 198 | (if (eq protocol 'OpenPGP) | ||
| 199 | epg-gpg-program | ||
| 200 | epg-gpgsm-program) | ||
| 201 | epg-gpg-home-directory | ||
| 202 | armor textmode include-certs | ||
| 203 | cipher-algorithm digest-algorithm compress-algorithm | ||
| 204 | (list #'epg-passphrase-callback-function) | ||
| 205 | nil | ||
| 206 | nil nil nil nil nil nil nil))) | ||
| 207 | |||
| 208 | (defun epg-context-protocol (context) | ||
| 209 | "Return the protocol used within CONTEXT." | ||
| 210 | (unless (eq (car-safe context) 'epg-context) | ||
| 211 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 212 | (aref (cdr context) 0)) | ||
| 213 | |||
| 214 | (defun epg-context-program (context) | ||
| 215 | "Return the gpg or gpgsm executable used within CONTEXT." | ||
| 216 | (unless (eq (car-safe context) 'epg-context) | ||
| 217 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 218 | (aref (cdr context) 1)) | ||
| 219 | |||
| 220 | (defun epg-context-home-directory (context) | ||
| 221 | "Return the GnuPG home directory used in CONTEXT." | ||
| 222 | (unless (eq (car-safe context) 'epg-context) | ||
| 223 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 224 | (aref (cdr context) 2)) | ||
| 225 | |||
| 226 | (defun epg-context-armor (context) | ||
| 227 | "Return t if the output should be ASCII armored in CONTEXT." | ||
| 228 | (unless (eq (car-safe context) 'epg-context) | ||
| 229 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 230 | (aref (cdr context) 3)) | ||
| 231 | |||
| 232 | (defun epg-context-textmode (context) | ||
| 233 | "Return t if canonical text mode should be used in CONTEXT." | ||
| 234 | (unless (eq (car-safe context) 'epg-context) | ||
| 235 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 236 | (aref (cdr context) 4)) | ||
| 237 | |||
| 238 | (defun epg-context-include-certs (context) | ||
| 239 | "Return how many certificates should be included in an S/MIME signed message." | ||
| 240 | (unless (eq (car-safe context) 'epg-context) | ||
| 241 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 242 | (aref (cdr context) 5)) | ||
| 243 | |||
| 244 | (defun epg-context-cipher-algorithm (context) | ||
| 245 | "Return the cipher algorithm in CONTEXT." | ||
| 246 | (unless (eq (car-safe context) 'epg-context) | ||
| 247 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 248 | (aref (cdr context) 6)) | ||
| 249 | |||
| 250 | (defun epg-context-digest-algorithm (context) | ||
| 251 | "Return the digest algorithm in CONTEXT." | ||
| 252 | (unless (eq (car-safe context) 'epg-context) | ||
| 253 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 254 | (aref (cdr context) 7)) | ||
| 255 | |||
| 256 | (defun epg-context-compress-algorithm (context) | ||
| 257 | "Return the compress algorithm in CONTEXT." | ||
| 258 | (unless (eq (car-safe context) 'epg-context) | ||
| 259 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 260 | (aref (cdr context) 8)) | ||
| 261 | |||
| 262 | (defun epg-context-passphrase-callback (context) | ||
| 263 | "Return the function used to query passphrase." | ||
| 264 | (unless (eq (car-safe context) 'epg-context) | ||
| 265 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 266 | (aref (cdr context) 9)) | ||
| 267 | |||
| 268 | (defun epg-context-progress-callback (context) | ||
| 269 | "Return the function which handles progress update." | ||
| 270 | (unless (eq (car-safe context) 'epg-context) | ||
| 271 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 272 | (aref (cdr context) 10)) | ||
| 273 | |||
| 274 | (defun epg-context-signers (context) | ||
| 275 | "Return the list of key-id for signing." | ||
| 276 | (unless (eq (car-safe context) 'epg-context) | ||
| 277 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 278 | (aref (cdr context) 11)) | ||
| 279 | |||
| 280 | (defun epg-context-sig-notations (context) | ||
| 281 | "Return the list of notations for signing." | ||
| 282 | (unless (eq (car-safe context) 'epg-context) | ||
| 283 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 284 | (aref (cdr context) 12)) | ||
| 285 | |||
| 286 | (defun epg-context-process (context) | ||
| 287 | "Return the process object of `epg-gpg-program'. | ||
| 288 | This function is for internal use only." | ||
| 289 | (unless (eq (car-safe context) 'epg-context) | ||
| 290 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 291 | (aref (cdr context) 13)) | ||
| 292 | |||
| 293 | (defun epg-context-output-file (context) | ||
| 294 | "Return the output file of `epg-gpg-program'. | ||
| 295 | This function is for internal use only." | ||
| 296 | (unless (eq (car-safe context) 'epg-context) | ||
| 297 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 298 | (aref (cdr context) 14)) | ||
| 299 | |||
| 300 | (defun epg-context-result (context) | ||
| 301 | "Return the result of the previous cryptographic operation." | ||
| 302 | (unless (eq (car-safe context) 'epg-context) | ||
| 303 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 304 | (aref (cdr context) 15)) | ||
| 305 | |||
| 306 | (defun epg-context-operation (context) | ||
| 307 | "Return the name of the current cryptographic operation." | ||
| 308 | (unless (eq (car-safe context) 'epg-context) | ||
| 309 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 310 | (aref (cdr context) 16)) | ||
| 311 | |||
| 312 | (defun epg-context-pinentry-mode (context) | ||
| 313 | "Return the mode of pinentry invocation." | ||
| 314 | (unless (eq (car-safe context) 'epg-context) | ||
| 315 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 316 | (aref (cdr context) 17)) | ||
| 317 | |||
| 318 | (defun epg-context-set-protocol (context protocol) | ||
| 319 | "Set the protocol used within CONTEXT." | ||
| 320 | (unless (eq (car-safe context) 'epg-context) | ||
| 321 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 322 | (aset (cdr context) 0 protocol)) | ||
| 323 | |||
| 324 | (defun epg-context-set-program (context protocol) | ||
| 325 | "Set the gpg or gpgsm executable used within CONTEXT." | ||
| 326 | (unless (eq (car-safe context) 'epg-context) | ||
| 327 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 328 | (aset (cdr context) 1 protocol)) | ||
| 329 | |||
| 330 | (defun epg-context-set-home-directory (context directory) | ||
| 331 | "Set the GnuPG home directory." | ||
| 332 | (unless (eq (car-safe context) 'epg-context) | ||
| 333 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 334 | (aset (cdr context) 2 directory)) | ||
| 335 | 225 | ||
| 336 | (defun epg-context-set-armor (context armor) | 226 | (defun epg-context-set-armor (context armor) |
| 337 | "Specify if the output should be ASCII armored in CONTEXT." | 227 | "Specify if the output should be ASCII armored in CONTEXT." |
| 338 | (unless (eq (car-safe context) 'epg-context) | 228 | (declare (obsolete setf "25.1")) |
| 339 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 229 | (setf (epg-context-armor context) armor)) |
| 340 | (aset (cdr context) 3 armor)) | ||
| 341 | 230 | ||
| 342 | (defun epg-context-set-textmode (context textmode) | 231 | (defun epg-context-set-textmode (context textmode) |
| 343 | "Specify if canonical text mode should be used in CONTEXT." | 232 | "Specify if canonical text mode should be used in CONTEXT." |
| 344 | (unless (eq (car-safe context) 'epg-context) | 233 | (declare (obsolete setf "25.1")) |
| 345 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 234 | (setf (epg-context-textmode context) textmode)) |
| 346 | (aset (cdr context) 4 textmode)) | ||
| 347 | |||
| 348 | (defun epg-context-set-include-certs (context include-certs) | ||
| 349 | "Set how many certificates should be included in an S/MIME signed message." | ||
| 350 | (unless (eq (car-safe context) 'epg-context) | ||
| 351 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 352 | (aset (cdr context) 5 include-certs)) | ||
| 353 | |||
| 354 | (defun epg-context-set-cipher-algorithm (context cipher-algorithm) | ||
| 355 | "Set the cipher algorithm in CONTEXT." | ||
| 356 | (unless (eq (car-safe context) 'epg-context) | ||
| 357 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 358 | (aset (cdr context) 6 cipher-algorithm)) | ||
| 359 | |||
| 360 | (defun epg-context-set-digest-algorithm (context digest-algorithm) | ||
| 361 | "Set the digest algorithm in CONTEXT." | ||
| 362 | (unless (eq (car-safe context) 'epg-context) | ||
| 363 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 364 | (aset (cdr context) 7 digest-algorithm)) | ||
| 365 | |||
| 366 | (defun epg-context-set-compress-algorithm (context compress-algorithm) | ||
| 367 | "Set the compress algorithm in CONTEXT." | ||
| 368 | (unless (eq (car-safe context) 'epg-context) | ||
| 369 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 370 | (aset (cdr context) 8 compress-algorithm)) | ||
| 371 | 235 | ||
| 372 | (defun epg-context-set-passphrase-callback (context | 236 | (defun epg-context-set-passphrase-callback (context |
| 373 | passphrase-callback) | 237 | passphrase-callback) |
| @@ -384,11 +248,11 @@ on the external program called `gpg-agent' for passphrase query. | |||
| 384 | If you really want to intercept passphrase query, consider | 248 | If you really want to intercept passphrase query, consider |
| 385 | installing GnuPG 1.x _along with_ GnuPG 2.x, which does passphrase | 249 | installing GnuPG 1.x _along with_ GnuPG 2.x, which does passphrase |
| 386 | query by itself and Emacs can intercept them." | 250 | query by itself and Emacs can intercept them." |
| 387 | (unless (eq (car-safe context) 'epg-context) | 251 | ;; (declare (obsolete setf "25.1")) |
| 388 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 252 | (setf (epg-context-passphrase-callback context) |
| 389 | (aset (cdr context) 9 (if (consp passphrase-callback) | 253 | (if (consp passphrase-callback) ;FIXME: functions can also be consp! |
| 390 | passphrase-callback | 254 | passphrase-callback |
| 391 | (list passphrase-callback)))) | 255 | (list passphrase-callback)))) |
| 392 | 256 | ||
| 393 | (defun epg-context-set-progress-callback (context | 257 | (defun epg-context-set-progress-callback (context |
| 394 | progress-callback) | 258 | progress-callback) |
| @@ -401,607 +265,119 @@ The function gets six arguments: the context, the operation | |||
| 401 | description, the character to display a progress unit, the | 265 | description, the character to display a progress unit, the |
| 402 | current amount done, the total amount to be done, and the | 266 | current amount done, the total amount to be done, and the |
| 403 | callback data (if any)." | 267 | callback data (if any)." |
| 404 | (unless (eq (car-safe context) 'epg-context) | 268 | (setf (epg-context-progress-callback context) |
| 405 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 269 | (if (consp progress-callback) ;FIXME: could be a function! |
| 406 | (aset (cdr context) 10 (if (consp progress-callback) | 270 | progress-callback |
| 407 | progress-callback | 271 | (list progress-callback)))) |
| 408 | (list progress-callback)))) | ||
| 409 | 272 | ||
| 410 | (defun epg-context-set-signers (context signers) | 273 | (defun epg-context-set-signers (context signers) |
| 411 | "Set the list of key-id for signing." | 274 | "Set the list of key-id for signing." |
| 412 | (unless (eq (car-safe context) 'epg-context) | 275 | (declare (obsolete setf "25.1")) |
| 413 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 276 | (setf (epg-context-signers context) signers)) |
| 414 | (aset (cdr context) 11 signers)) | 277 | |
| 415 | 278 | (cl-defstruct (epg-signature | |
| 416 | (defun epg-context-set-sig-notations (context notations) | 279 | (:constructor nil) |
| 417 | "Set the list of notations for signing." | 280 | (:constructor epg-make-signature |
| 418 | (unless (eq (car-safe context) 'epg-context) | 281 | (status &optional key-id)) |
| 419 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 282 | (:copier nil) |
| 420 | (aset (cdr context) 12 notations)) | 283 | (:predicate nil)) |
| 421 | 284 | status | |
| 422 | (defun epg-context-set-process (context process) | 285 | key-id |
| 423 | "Set the process object of `epg-gpg-program'. | 286 | validity |
| 424 | This function is for internal use only." | 287 | fingerprint |
| 425 | (unless (eq (car-safe context) 'epg-context) | 288 | creation-time |
| 426 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 289 | expiration-time |
| 427 | (aset (cdr context) 13 process)) | 290 | pubkey-algorithm |
| 428 | 291 | digest-algorithm | |
| 429 | (defun epg-context-set-output-file (context output-file) | 292 | class |
| 430 | "Set the output file of `epg-gpg-program'. | 293 | version |
| 431 | This function is for internal use only." | 294 | notations) |
| 432 | (unless (eq (car-safe context) 'epg-context) | 295 | |
| 433 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 296 | (cl-defstruct (epg-new-signature |
| 434 | (aset (cdr context) 14 output-file)) | 297 | (:constructor nil) |
| 435 | 298 | (:constructor epg-make-new-signature | |
| 436 | (defun epg-context-set-result (context result) | 299 | (type pubkey-algorithm digest-algorithm |
| 437 | "Set the result of the previous cryptographic operation." | 300 | class creation-time fingerprint)) |
| 438 | (unless (eq (car-safe context) 'epg-context) | 301 | (:copier nil) |
| 439 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 302 | (:predicate nil)) |
| 440 | (aset (cdr context) 15 result)) | 303 | (type nil :read-only t) |
| 441 | 304 | (pubkey-algorithm nil :read-only t) | |
| 442 | (defun epg-context-set-operation (context operation) | 305 | (digest-algorithm nil :read-only t) |
| 443 | "Set the name of the current cryptographic operation." | 306 | (class nil :read-only t) |
| 444 | (unless (eq (car-safe context) 'epg-context) | 307 | (creation-time nil :read-only t) |
| 445 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 308 | (fingerprint nil :read-only t)) |
| 446 | (aset (cdr context) 16 operation)) | 309 | |
| 447 | 310 | (cl-defstruct (epg-key | |
| 448 | (defun epg-context-set-pinentry-mode (context mode) | 311 | (:constructor nil) |
| 449 | "Set the mode of pinentry invocation." | 312 | (:constructor epg-make-key (owner-trust)) |
| 450 | (unless (eq (car-safe context) 'epg-context) | 313 | (:copier nil) |
| 451 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 314 | (:predicate nil)) |
| 452 | (unless (memq mode '(nil ask cancel error loopback)) | 315 | (owner-trust nil :read-only t) |
| 453 | (signal 'epg-error (list "Unknown pinentry mode" mode))) | 316 | sub-key-list user-id-list) |
| 454 | (aset (cdr context) 17 mode)) | 317 | |
| 455 | 318 | (cl-defstruct (epg-sub-key | |
| 456 | (defun epg-make-signature (status &optional key-id) | 319 | (:constructor nil) |
| 457 | "Return a signature object." | 320 | (:constructor epg-make-sub-key |
| 458 | (cons 'epg-signature (vector status key-id nil nil nil nil nil nil nil nil | 321 | (validity capability secret-p algorithm length id |
| 459 | nil))) | 322 | creation-time expiration-time)) |
| 460 | 323 | (:copier nil) | |
| 461 | (defun epg-signature-status (signature) | 324 | (:predicate nil)) |
| 462 | "Return the status code of SIGNATURE." | 325 | validity capability secret-p algorithm length id |
| 463 | (unless (eq (car-safe signature) 'epg-signature) | 326 | creation-time expiration-time fingerprint) |
| 464 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | 327 | |
| 465 | (aref (cdr signature) 0)) | 328 | (cl-defstruct (epg-user-id |
| 466 | 329 | (:constructor nil) | |
| 467 | (defun epg-signature-key-id (signature) | 330 | (:constructor epg-make-user-id (validity string)) |
| 468 | "Return the key-id of SIGNATURE." | 331 | (:copier nil) |
| 469 | (unless (eq (car-safe signature) 'epg-signature) | 332 | (:predicate nil)) |
| 470 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | 333 | validity string signature-list) |
| 471 | (aref (cdr signature) 1)) | 334 | |
| 472 | 335 | (cl-defstruct (epg-key-signature | |
| 473 | (defun epg-signature-validity (signature) | 336 | (:constructor nil) |
| 474 | "Return the validity of SIGNATURE." | 337 | (:constructor epg-make-key-signature |
| 475 | (unless (eq (car-safe signature) 'epg-signature) | 338 | (validity pubkey-algorithm key-id creation-time |
| 476 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | 339 | expiration-time user-id class |
| 477 | (aref (cdr signature) 2)) | 340 | exportable-p)) |
| 478 | 341 | (:copier nil) | |
| 479 | (defun epg-signature-fingerprint (signature) | 342 | (:predicate nil)) |
| 480 | "Return the fingerprint of SIGNATURE." | 343 | validity pubkey-algorithm key-id creation-time |
| 481 | (unless (eq (car-safe signature) 'epg-signature) | 344 | expiration-time user-id class |
| 482 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | 345 | exportable-p) |
| 483 | (aref (cdr signature) 3)) | 346 | |
| 484 | 347 | (cl-defstruct (epg-sig-notation | |
| 485 | (defun epg-signature-creation-time (signature) | 348 | (:constructor nil) |
| 486 | "Return the creation time of SIGNATURE." | 349 | (:constructor epg-make-sig-notation |
| 487 | (unless (eq (car-safe signature) 'epg-signature) | 350 | (name value &optional human-readable critical)) |
| 488 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | 351 | (:copier nil) |
| 489 | (aref (cdr signature) 4)) | 352 | (:predicate nil)) |
| 490 | 353 | name value human-readable critical) | |
| 491 | (defun epg-signature-expiration-time (signature) | 354 | |
| 492 | "Return the expiration time of SIGNATURE." | 355 | (cl-defstruct (epg-import-status |
| 493 | (unless (eq (car-safe signature) 'epg-signature) | 356 | (:constructor nil) |
| 494 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | 357 | (:constructor epg-make-import-status |
| 495 | (aref (cdr signature) 5)) | 358 | (fingerprint |
| 496 | 359 | &optional reason new user-id signature sub-key secret)) | |
| 497 | (defun epg-signature-pubkey-algorithm (signature) | 360 | (:copier nil) |
| 498 | "Return the public key algorithm of SIGNATURE." | 361 | (:predicate nil)) |
| 499 | (unless (eq (car-safe signature) 'epg-signature) | 362 | fingerprint reason new user-id signature sub-key secret) |
| 500 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | 363 | |
| 501 | (aref (cdr signature) 6)) | 364 | (cl-defstruct (epg-import-result |
| 502 | 365 | (:constructor nil) | |
| 503 | (defun epg-signature-digest-algorithm (signature) | 366 | (:constructor epg-make-import-result |
| 504 | "Return the digest algorithm of SIGNATURE." | 367 | (considered no-user-id imported imported-rsa |
| 505 | (unless (eq (car-safe signature) 'epg-signature) | 368 | unchanged new-user-ids new-sub-keys |
| 506 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | 369 | new-signatures new-revocations |
| 507 | (aref (cdr signature) 7)) | 370 | secret-read secret-imported |
| 508 | 371 | secret-unchanged not-imported | |
| 509 | (defun epg-signature-class (signature) | 372 | imports)) |
| 510 | "Return the class of SIGNATURE." | 373 | (:copier nil) |
| 511 | (unless (eq (car-safe signature) 'epg-signature) | 374 | (:predicate nil)) |
| 512 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | 375 | considered no-user-id imported imported-rsa |
| 513 | (aref (cdr signature) 8)) | 376 | unchanged new-user-ids new-sub-keys |
| 514 | 377 | new-signatures new-revocations | |
| 515 | (defun epg-signature-version (signature) | 378 | secret-read secret-imported |
| 516 | "Return the version of SIGNATURE." | 379 | secret-unchanged not-imported |
| 517 | (unless (eq (car-safe signature) 'epg-signature) | 380 | imports) |
| 518 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 519 | (aref (cdr signature) 9)) | ||
| 520 | |||
| 521 | (defun epg-sig-notations (signature) | ||
| 522 | "Return the list of notations of SIGNATURE." | ||
| 523 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 524 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 525 | (aref (cdr signature) 10)) | ||
| 526 | |||
| 527 | (defun epg-signature-set-status (signature status) | ||
| 528 | "Set the status code of SIGNATURE." | ||
| 529 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 530 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 531 | (aset (cdr signature) 0 status)) | ||
| 532 | |||
| 533 | (defun epg-signature-set-key-id (signature key-id) | ||
| 534 | "Set the key-id of SIGNATURE." | ||
| 535 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 536 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 537 | (aset (cdr signature) 1 key-id)) | ||
| 538 | |||
| 539 | (defun epg-signature-set-validity (signature validity) | ||
| 540 | "Set the validity of SIGNATURE." | ||
| 541 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 542 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 543 | (aset (cdr signature) 2 validity)) | ||
| 544 | |||
| 545 | (defun epg-signature-set-fingerprint (signature fingerprint) | ||
| 546 | "Set the fingerprint of SIGNATURE." | ||
| 547 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 548 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 549 | (aset (cdr signature) 3 fingerprint)) | ||
| 550 | |||
| 551 | (defun epg-signature-set-creation-time (signature creation-time) | ||
| 552 | "Set the creation time of SIGNATURE." | ||
| 553 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 554 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 555 | (aset (cdr signature) 4 creation-time)) | ||
| 556 | |||
| 557 | (defun epg-signature-set-expiration-time (signature expiration-time) | ||
| 558 | "Set the expiration time of SIGNATURE." | ||
| 559 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 560 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 561 | (aset (cdr signature) 5 expiration-time)) | ||
| 562 | |||
| 563 | (defun epg-signature-set-pubkey-algorithm (signature pubkey-algorithm) | ||
| 564 | "Set the public key algorithm of SIGNATURE." | ||
| 565 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 566 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 567 | (aset (cdr signature) 6 pubkey-algorithm)) | ||
| 568 | |||
| 569 | (defun epg-signature-set-digest-algorithm (signature digest-algorithm) | ||
| 570 | "Set the digest algorithm of SIGNATURE." | ||
| 571 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 572 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 573 | (aset (cdr signature) 7 digest-algorithm)) | ||
| 574 | |||
| 575 | (defun epg-signature-set-class (signature class) | ||
| 576 | "Set the class of SIGNATURE." | ||
| 577 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 578 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 579 | (aset (cdr signature) 8 class)) | ||
| 580 | |||
| 581 | (defun epg-signature-set-version (signature version) | ||
| 582 | "Set the version of SIGNATURE." | ||
| 583 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 584 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 585 | (aset (cdr signature) 9 version)) | ||
| 586 | |||
| 587 | (defun epg-signature-set-notations (signature notations) | ||
| 588 | "Set the list of notations of SIGNATURE." | ||
| 589 | (unless (eq (car-safe signature) 'epg-signature) | ||
| 590 | (signal 'wrong-type-argument (list 'epg-signature-p signature))) | ||
| 591 | (aset (cdr signature) 10 notations)) | ||
| 592 | |||
| 593 | (defun epg-make-new-signature (type pubkey-algorithm digest-algorithm | ||
| 594 | class creation-time fingerprint) | ||
| 595 | "Return a new signature object." | ||
| 596 | (cons 'epg-new-signature (vector type pubkey-algorithm digest-algorithm | ||
| 597 | class creation-time fingerprint))) | ||
| 598 | |||
| 599 | (defun epg-new-signature-type (new-signature) | ||
| 600 | "Return the type of NEW-SIGNATURE." | ||
| 601 | (unless (eq (car-safe new-signature) 'epg-new-signature) | ||
| 602 | (signal 'wrong-type-argument (list 'epg-new-signature-p new-signature))) | ||
| 603 | (aref (cdr new-signature) 0)) | ||
| 604 | |||
| 605 | (defun epg-new-signature-pubkey-algorithm (new-signature) | ||
| 606 | "Return the public key algorithm of NEW-SIGNATURE." | ||
| 607 | (unless (eq (car-safe new-signature) 'epg-new-signature) | ||
| 608 | (signal 'wrong-type-argument (list 'epg-new-signature-p new-signature))) | ||
| 609 | (aref (cdr new-signature) 1)) | ||
| 610 | |||
| 611 | (defun epg-new-signature-digest-algorithm (new-signature) | ||
| 612 | "Return the digest algorithm of NEW-SIGNATURE." | ||
| 613 | (unless (eq (car-safe new-signature) 'epg-new-signature) | ||
| 614 | (signal 'wrong-type-argument (list 'epg-new-signature-p new-signature))) | ||
| 615 | (aref (cdr new-signature) 2)) | ||
| 616 | |||
| 617 | (defun epg-new-signature-class (new-signature) | ||
| 618 | "Return the class of NEW-SIGNATURE." | ||
| 619 | (unless (eq (car-safe new-signature) 'epg-new-signature) | ||
| 620 | (signal 'wrong-type-argument (list 'epg-new-signature-p new-signature))) | ||
| 621 | (aref (cdr new-signature) 3)) | ||
| 622 | |||
| 623 | (defun epg-new-signature-creation-time (new-signature) | ||
| 624 | "Return the creation time of NEW-SIGNATURE." | ||
| 625 | (unless (eq (car-safe new-signature) 'epg-new-signature) | ||
| 626 | (signal 'wrong-type-argument (list 'epg-new-signature-p new-signature))) | ||
| 627 | (aref (cdr new-signature) 4)) | ||
| 628 | |||
| 629 | (defun epg-new-signature-fingerprint (new-signature) | ||
| 630 | "Return the fingerprint of NEW-SIGNATURE." | ||
| 631 | (unless (eq (car-safe new-signature) 'epg-new-signature) | ||
| 632 | (signal 'wrong-type-argument (list 'epg-new-signature-p new-signature))) | ||
| 633 | (aref (cdr new-signature) 5)) | ||
| 634 | |||
| 635 | (defun epg-make-key (owner-trust) | ||
| 636 | "Return a key object." | ||
| 637 | (cons 'epg-key (vector owner-trust nil nil))) | ||
| 638 | |||
| 639 | (defun epg-key-owner-trust (key) | ||
| 640 | "Return the owner trust of KEY." | ||
| 641 | (unless (eq (car-safe key) 'epg-key) | ||
| 642 | (signal 'wrong-type-argument (list 'epg-key-p key))) | ||
| 643 | (aref (cdr key) 0)) | ||
| 644 | |||
| 645 | (defun epg-key-sub-key-list (key) | ||
| 646 | "Return the sub key list of KEY." | ||
| 647 | (unless (eq (car-safe key) 'epg-key) | ||
| 648 | (signal 'wrong-type-argument (list 'epg-key-p key))) | ||
| 649 | (aref (cdr key) 1)) | ||
| 650 | |||
| 651 | (defun epg-key-user-id-list (key) | ||
| 652 | "Return the user ID list of KEY." | ||
| 653 | (unless (eq (car-safe key) 'epg-key) | ||
| 654 | (signal 'wrong-type-argument (list 'epg-key-p key))) | ||
| 655 | (aref (cdr key) 2)) | ||
| 656 | |||
| 657 | (defun epg-key-set-sub-key-list (key sub-key-list) | ||
| 658 | "Set the sub key list of KEY." | ||
| 659 | (unless (eq (car-safe key) 'epg-key) | ||
| 660 | (signal 'wrong-type-argument (list 'epg-key-p key))) | ||
| 661 | (aset (cdr key) 1 sub-key-list)) | ||
| 662 | |||
| 663 | (defun epg-key-set-user-id-list (key user-id-list) | ||
| 664 | "Set the user ID list of KEY." | ||
| 665 | (unless (eq (car-safe key) 'epg-key) | ||
| 666 | (signal 'wrong-type-argument (list 'epg-key-p key))) | ||
| 667 | (aset (cdr key) 2 user-id-list)) | ||
| 668 | |||
| 669 | (defun epg-make-sub-key (validity capability secret-p algorithm length id | ||
| 670 | creation-time expiration-time) | ||
| 671 | "Return a sub key object." | ||
| 672 | (cons 'epg-sub-key | ||
| 673 | (vector validity capability secret-p algorithm length id creation-time | ||
| 674 | expiration-time nil))) | ||
| 675 | |||
| 676 | (defun epg-sub-key-validity (sub-key) | ||
| 677 | "Return the validity of SUB-KEY." | ||
| 678 | (unless (eq (car-safe sub-key) 'epg-sub-key) | ||
| 679 | (signal 'wrong-type-argument (list 'epg-sub-key-p sub-key))) | ||
| 680 | (aref (cdr sub-key) 0)) | ||
| 681 | |||
| 682 | (defun epg-sub-key-capability (sub-key) | ||
| 683 | "Return the capability of SUB-KEY." | ||
| 684 | (unless (eq (car-safe sub-key) 'epg-sub-key) | ||
| 685 | (signal 'wrong-type-argument (list 'epg-sub-key-p sub-key))) | ||
| 686 | (aref (cdr sub-key) 1)) | ||
| 687 | |||
| 688 | (defun epg-sub-key-secret-p (sub-key) | ||
| 689 | "Return non-nil if SUB-KEY is a secret key." | ||
| 690 | (unless (eq (car-safe sub-key) 'epg-sub-key) | ||
| 691 | (signal 'wrong-type-argument (list 'epg-sub-key-p sub-key))) | ||
| 692 | (aref (cdr sub-key) 2)) | ||
| 693 | |||
| 694 | (defun epg-sub-key-algorithm (sub-key) | ||
| 695 | "Return the algorithm of SUB-KEY." | ||
| 696 | (unless (eq (car-safe sub-key) 'epg-sub-key) | ||
| 697 | (signal 'wrong-type-argument (list 'epg-sub-key-p sub-key))) | ||
| 698 | (aref (cdr sub-key) 3)) | ||
| 699 | |||
| 700 | (defun epg-sub-key-length (sub-key) | ||
| 701 | "Return the length of SUB-KEY." | ||
| 702 | (unless (eq (car-safe sub-key) 'epg-sub-key) | ||
| 703 | (signal 'wrong-type-argument (list 'epg-sub-key-p sub-key))) | ||
| 704 | (aref (cdr sub-key) 4)) | ||
| 705 | |||
| 706 | (defun epg-sub-key-id (sub-key) | ||
| 707 | "Return the ID of SUB-KEY." | ||
| 708 | (unless (eq (car-safe sub-key) 'epg-sub-key) | ||
| 709 | (signal 'wrong-type-argument (list 'epg-sub-key-p sub-key))) | ||
| 710 | (aref (cdr sub-key) 5)) | ||
| 711 | |||
| 712 | (defun epg-sub-key-creation-time (sub-key) | ||
| 713 | "Return the creation time of SUB-KEY." | ||
| 714 | (unless (eq (car-safe sub-key) 'epg-sub-key) | ||
| 715 | (signal 'wrong-type-argument (list 'epg-sub-key-p sub-key))) | ||
| 716 | (aref (cdr sub-key) 6)) | ||
| 717 | |||
| 718 | (defun epg-sub-key-expiration-time (sub-key) | ||
| 719 | "Return the expiration time of SUB-KEY." | ||
| 720 | (unless (eq (car-safe sub-key) 'epg-sub-key) | ||
| 721 | (signal 'wrong-type-argument (list 'epg-sub-key-p sub-key))) | ||
| 722 | (aref (cdr sub-key) 7)) | ||
| 723 | |||
| 724 | (defun epg-sub-key-fingerprint (sub-key) | ||
| 725 | "Return the fingerprint of SUB-KEY." | ||
| 726 | (unless (eq (car-safe sub-key) 'epg-sub-key) | ||
| 727 | (signal 'wrong-type-argument (list 'epg-sub-key-p sub-key))) | ||
| 728 | (aref (cdr sub-key) 8)) | ||
| 729 | |||
| 730 | (defun epg-sub-key-set-fingerprint (sub-key fingerprint) | ||
| 731 | "Set the fingerprint of SUB-KEY. | ||
| 732 | This function is for internal use only." | ||
| 733 | (unless (eq (car-safe sub-key) 'epg-sub-key) | ||
| 734 | (signal 'wrong-type-argument (list 'epg-sub-key-p sub-key))) | ||
| 735 | (aset (cdr sub-key) 8 fingerprint)) | ||
| 736 | |||
| 737 | (defun epg-make-user-id (validity string) | ||
| 738 | "Return a user ID object." | ||
| 739 | (cons 'epg-user-id (vector validity string nil))) | ||
| 740 | |||
| 741 | (defun epg-user-id-validity (user-id) | ||
| 742 | "Return the validity of USER-ID." | ||
| 743 | (unless (eq (car-safe user-id) 'epg-user-id) | ||
| 744 | (signal 'wrong-type-argument (list 'epg-user-id-p user-id))) | ||
| 745 | (aref (cdr user-id) 0)) | ||
| 746 | |||
| 747 | (defun epg-user-id-string (user-id) | ||
| 748 | "Return the name of USER-ID." | ||
| 749 | (unless (eq (car-safe user-id) 'epg-user-id) | ||
| 750 | (signal 'wrong-type-argument (list 'epg-user-id-p user-id))) | ||
| 751 | (aref (cdr user-id) 1)) | ||
| 752 | |||
| 753 | (defun epg-user-id-signature-list (user-id) | ||
| 754 | "Return the signature list of USER-ID." | ||
| 755 | (unless (eq (car-safe user-id) 'epg-user-id) | ||
| 756 | (signal 'wrong-type-argument (list 'epg-user-id-p user-id))) | ||
| 757 | (aref (cdr user-id) 2)) | ||
| 758 | |||
| 759 | (defun epg-user-id-set-signature-list (user-id signature-list) | ||
| 760 | "Set the signature list of USER-ID." | ||
| 761 | (unless (eq (car-safe user-id) 'epg-user-id) | ||
| 762 | (signal 'wrong-type-argument (list 'epg-user-id-p user-id))) | ||
| 763 | (aset (cdr user-id) 2 signature-list)) | ||
| 764 | |||
| 765 | (defun epg-make-key-signature (validity pubkey-algorithm key-id creation-time | ||
| 766 | expiration-time user-id class | ||
| 767 | exportable-p) | ||
| 768 | "Return a key signature object." | ||
| 769 | (cons 'epg-key-signature | ||
| 770 | (vector validity pubkey-algorithm key-id creation-time expiration-time | ||
| 771 | user-id class exportable-p))) | ||
| 772 | |||
| 773 | (defun epg-key-signature-validity (key-signature) | ||
| 774 | "Return the validity of KEY-SIGNATURE." | ||
| 775 | (unless (eq (car-safe key-signature) 'epg-key-signature) | ||
| 776 | (signal 'wrong-type-argument (list 'epg-key-signature-p key-signature))) | ||
| 777 | (aref (cdr key-signature) 0)) | ||
| 778 | |||
| 779 | (defun epg-key-signature-pubkey-algorithm (key-signature) | ||
| 780 | "Return the public key algorithm of KEY-SIGNATURE." | ||
| 781 | (unless (eq (car-safe key-signature) 'epg-key-signature) | ||
| 782 | (signal 'wrong-type-argument (list 'epg-key-signature-p key-signature))) | ||
| 783 | (aref (cdr key-signature) 1)) | ||
| 784 | |||
| 785 | (defun epg-key-signature-key-id (key-signature) | ||
| 786 | "Return the key-id of KEY-SIGNATURE." | ||
| 787 | (unless (eq (car-safe key-signature) 'epg-key-signature) | ||
| 788 | (signal 'wrong-type-argument (list 'epg-key-signature-p key-signature))) | ||
| 789 | (aref (cdr key-signature) 2)) | ||
| 790 | |||
| 791 | (defun epg-key-signature-creation-time (key-signature) | ||
| 792 | "Return the creation time of KEY-SIGNATURE." | ||
| 793 | (unless (eq (car-safe key-signature) 'epg-key-signature) | ||
| 794 | (signal 'wrong-type-argument (list 'epg-key-signature-p key-signature))) | ||
| 795 | (aref (cdr key-signature) 3)) | ||
| 796 | |||
| 797 | (defun epg-key-signature-expiration-time (key-signature) | ||
| 798 | "Return the expiration time of KEY-SIGNATURE." | ||
| 799 | (unless (eq (car-safe key-signature) 'epg-key-signature) | ||
| 800 | (signal 'wrong-type-argument (list 'epg-key-signature-p key-signature))) | ||
| 801 | (aref (cdr key-signature) 4)) | ||
| 802 | |||
| 803 | (defun epg-key-signature-user-id (key-signature) | ||
| 804 | "Return the user-id of KEY-SIGNATURE." | ||
| 805 | (unless (eq (car-safe key-signature) 'epg-key-signature) | ||
| 806 | (signal 'wrong-type-argument (list 'epg-key-signature-p key-signature))) | ||
| 807 | (aref (cdr key-signature) 5)) | ||
| 808 | |||
| 809 | (defun epg-key-signature-class (key-signature) | ||
| 810 | "Return the class of KEY-SIGNATURE." | ||
| 811 | (unless (eq (car-safe key-signature) 'epg-key-signature) | ||
| 812 | (signal 'wrong-type-argument (list 'epg-key-signature-p key-signature))) | ||
| 813 | (aref (cdr key-signature) 6)) | ||
| 814 | |||
| 815 | (defun epg-key-signature-exportable-p (key-signature) | ||
| 816 | "Return t if KEY-SIGNATURE is exportable." | ||
| 817 | (unless (eq (car-safe key-signature) 'epg-key-signature) | ||
| 818 | (signal 'wrong-type-argument (list 'epg-key-signature-p key-signature))) | ||
| 819 | (aref (cdr key-signature) 7)) | ||
| 820 | |||
| 821 | (defun epg-make-sig-notation (name value &optional human-readable | ||
| 822 | critical) | ||
| 823 | "Return a notation object." | ||
| 824 | (cons 'epg-sig-notation (vector name value human-readable critical))) | ||
| 825 | |||
| 826 | (defun epg-sig-notation-name (sig-notation) | ||
| 827 | "Return the name of SIG-NOTATION." | ||
| 828 | (unless (eq (car-safe sig-notation) 'epg-sig-notation) | ||
| 829 | (signal 'wrong-type-argument (list 'epg-sig-notation-p | ||
| 830 | sig-notation))) | ||
| 831 | (aref (cdr sig-notation) 0)) | ||
| 832 | |||
| 833 | (defun epg-sig-notation-value (sig-notation) | ||
| 834 | "Return the value of SIG-NOTATION." | ||
| 835 | (unless (eq (car-safe sig-notation) 'epg-sig-notation) | ||
| 836 | (signal 'wrong-type-argument (list 'epg-sig-notation-p | ||
| 837 | sig-notation))) | ||
| 838 | (aref (cdr sig-notation) 1)) | ||
| 839 | |||
| 840 | (defun epg-sig-notation-human-readable (sig-notation) | ||
| 841 | "Return the human-readable of SIG-NOTATION." | ||
| 842 | (unless (eq (car-safe sig-notation) 'epg-sig-notation) | ||
| 843 | (signal 'wrong-type-argument (list 'epg-sig-notation-p | ||
| 844 | sig-notation))) | ||
| 845 | (aref (cdr sig-notation) 2)) | ||
| 846 | |||
| 847 | (defun epg-sig-notation-critical (sig-notation) | ||
| 848 | "Return the critical of SIG-NOTATION." | ||
| 849 | (unless (eq (car-safe sig-notation) 'epg-sig-notation) | ||
| 850 | (signal 'wrong-type-argument (list 'epg-sig-notation-p | ||
| 851 | sig-notation))) | ||
| 852 | (aref (cdr sig-notation) 3)) | ||
| 853 | |||
| 854 | (defun epg-sig-notation-set-value (sig-notation value) | ||
| 855 | "Set the value of SIG-NOTATION." | ||
| 856 | (unless (eq (car-safe sig-notation) 'epg-sig-notation) | ||
| 857 | (signal 'wrong-type-argument (list 'epg-sig-notation-p | ||
| 858 | sig-notation))) | ||
| 859 | (aset (cdr sig-notation) 1 value)) | ||
| 860 | |||
| 861 | (defun epg-make-import-status (fingerprint &optional reason new user-id | ||
| 862 | signature sub-key secret) | ||
| 863 | "Return an import status object." | ||
| 864 | (cons 'epg-import-status (vector fingerprint reason new user-id signature | ||
| 865 | sub-key secret))) | ||
| 866 | |||
| 867 | (defun epg-import-status-fingerprint (import-status) | ||
| 868 | "Return the fingerprint of the key that was considered." | ||
| 869 | (unless (eq (car-safe import-status) 'epg-import-status) | ||
| 870 | (signal 'wrong-type-argument (list 'epg-import-status-p import-status))) | ||
| 871 | (aref (cdr import-status) 0)) | ||
| 872 | |||
| 873 | (defun epg-import-status-reason (import-status) | ||
| 874 | "Return the reason code for import failure." | ||
| 875 | (unless (eq (car-safe import-status) 'epg-import-status) | ||
| 876 | (signal 'wrong-type-argument (list 'epg-import-status-p import-status))) | ||
| 877 | (aref (cdr import-status) 1)) | ||
| 878 | |||
| 879 | (defun epg-import-status-new (import-status) | ||
| 880 | "Return t if the imported key was new." | ||
| 881 | (unless (eq (car-safe import-status) 'epg-import-status) | ||
| 882 | (signal 'wrong-type-argument (list 'epg-import-status-p import-status))) | ||
| 883 | (aref (cdr import-status) 2)) | ||
| 884 | |||
| 885 | (defun epg-import-status-user-id (import-status) | ||
| 886 | "Return t if the imported key contained new user IDs." | ||
| 887 | (unless (eq (car-safe import-status) 'epg-import-status) | ||
| 888 | (signal 'wrong-type-argument (list 'epg-import-status-p import-status))) | ||
| 889 | (aref (cdr import-status) 3)) | ||
| 890 | |||
| 891 | (defun epg-import-status-signature (import-status) | ||
| 892 | "Return t if the imported key contained new signatures." | ||
| 893 | (unless (eq (car-safe import-status) 'epg-import-status) | ||
| 894 | (signal 'wrong-type-argument (list 'epg-import-status-p import-status))) | ||
| 895 | (aref (cdr import-status) 4)) | ||
| 896 | |||
| 897 | (defun epg-import-status-sub-key (import-status) | ||
| 898 | "Return t if the imported key contained new sub keys." | ||
| 899 | (unless (eq (car-safe import-status) 'epg-import-status) | ||
| 900 | (signal 'wrong-type-argument (list 'epg-import-status-p import-status))) | ||
| 901 | (aref (cdr import-status) 5)) | ||
| 902 | |||
| 903 | (defun epg-import-status-secret (import-status) | ||
| 904 | "Return t if the imported key contained a secret key." | ||
| 905 | (unless (eq (car-safe import-status) 'epg-import-status) | ||
| 906 | (signal 'wrong-type-argument (list 'epg-import-status-p import-status))) | ||
| 907 | (aref (cdr import-status) 6)) | ||
| 908 | |||
| 909 | (defun epg-make-import-result (considered no-user-id imported imported-rsa | ||
| 910 | unchanged new-user-ids new-sub-keys | ||
| 911 | new-signatures new-revocations | ||
| 912 | secret-read secret-imported | ||
| 913 | secret-unchanged not-imported | ||
| 914 | imports) | ||
| 915 | "Return an import result object." | ||
| 916 | (cons 'epg-import-result (vector considered no-user-id imported imported-rsa | ||
| 917 | unchanged new-user-ids new-sub-keys | ||
| 918 | new-signatures new-revocations secret-read | ||
| 919 | secret-imported secret-unchanged | ||
| 920 | not-imported imports))) | ||
| 921 | |||
| 922 | (defun epg-import-result-considered (import-result) | ||
| 923 | "Return the total number of considered keys." | ||
| 924 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 925 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 926 | (aref (cdr import-result) 0)) | ||
| 927 | |||
| 928 | (defun epg-import-result-no-user-id (import-result) | ||
| 929 | "Return the number of keys without user ID." | ||
| 930 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 931 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 932 | (aref (cdr import-result) 1)) | ||
| 933 | |||
| 934 | (defun epg-import-result-imported (import-result) | ||
| 935 | "Return the number of imported keys." | ||
| 936 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 937 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 938 | (aref (cdr import-result) 2)) | ||
| 939 | |||
| 940 | (defun epg-import-result-imported-rsa (import-result) | ||
| 941 | "Return the number of imported RSA keys." | ||
| 942 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 943 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 944 | (aref (cdr import-result) 3)) | ||
| 945 | |||
| 946 | (defun epg-import-result-unchanged (import-result) | ||
| 947 | "Return the number of unchanged keys." | ||
| 948 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 949 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 950 | (aref (cdr import-result) 4)) | ||
| 951 | |||
| 952 | (defun epg-import-result-new-user-ids (import-result) | ||
| 953 | "Return the number of new user IDs." | ||
| 954 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 955 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 956 | (aref (cdr import-result) 5)) | ||
| 957 | |||
| 958 | (defun epg-import-result-new-sub-keys (import-result) | ||
| 959 | "Return the number of new sub keys." | ||
| 960 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 961 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 962 | (aref (cdr import-result) 6)) | ||
| 963 | |||
| 964 | (defun epg-import-result-new-signatures (import-result) | ||
| 965 | "Return the number of new signatures." | ||
| 966 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 967 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 968 | (aref (cdr import-result) 7)) | ||
| 969 | |||
| 970 | (defun epg-import-result-new-revocations (import-result) | ||
| 971 | "Return the number of new revocations." | ||
| 972 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 973 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 974 | (aref (cdr import-result) 8)) | ||
| 975 | |||
| 976 | (defun epg-import-result-secret-read (import-result) | ||
| 977 | "Return the total number of secret keys read." | ||
| 978 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 979 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 980 | (aref (cdr import-result) 9)) | ||
| 981 | |||
| 982 | (defun epg-import-result-secret-imported (import-result) | ||
| 983 | "Return the number of imported secret keys." | ||
| 984 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 985 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 986 | (aref (cdr import-result) 10)) | ||
| 987 | |||
| 988 | (defun epg-import-result-secret-unchanged (import-result) | ||
| 989 | "Return the number of unchanged secret keys." | ||
| 990 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 991 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 992 | (aref (cdr import-result) 11)) | ||
| 993 | |||
| 994 | (defun epg-import-result-not-imported (import-result) | ||
| 995 | "Return the number of keys not imported." | ||
| 996 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 997 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 998 | (aref (cdr import-result) 12)) | ||
| 999 | |||
| 1000 | (defun epg-import-result-imports (import-result) | ||
| 1001 | "Return the list of `epg-import-status' objects." | ||
| 1002 | (unless (eq (car-safe import-result) 'epg-import-result) | ||
| 1003 | (signal 'wrong-type-argument (list 'epg-import-result-p import-result))) | ||
| 1004 | (aref (cdr import-result) 13)) | ||
| 1005 | 381 | ||
| 1006 | (defun epg-context-result-for (context name) | 382 | (defun epg-context-result-for (context name) |
| 1007 | "Return the result of CONTEXT associated with NAME." | 383 | "Return the result of CONTEXT associated with NAME." |
| @@ -1013,7 +389,7 @@ This function is for internal use only." | |||
| 1013 | (entry (assq name result))) | 389 | (entry (assq name result))) |
| 1014 | (if entry | 390 | (if entry |
| 1015 | (setcdr entry value) | 391 | (setcdr entry value) |
| 1016 | (epg-context-set-result context (cons (cons name value) result))))) | 392 | (setf (epg-context-result context) (cons (cons name value) result))))) |
| 1017 | 393 | ||
| 1018 | (defun epg-signature-to-string (signature) | 394 | (defun epg-signature-to-string (signature) |
| 1019 | "Convert SIGNATURE to a human readable string." | 395 | "Convert SIGNATURE to a human readable string." |
| @@ -1268,7 +644,7 @@ This function is for internal use only." | |||
| 1268 | (setq process (apply #'start-process "epg" buffer | 644 | (setq process (apply #'start-process "epg" buffer |
| 1269 | (epg-context-program context) args))) | 645 | (epg-context-program context) args))) |
| 1270 | (set-process-filter process #'epg--process-filter) | 646 | (set-process-filter process #'epg--process-filter) |
| 1271 | (epg-context-set-process context process))) | 647 | (setf (epg-context-process context) process))) |
| 1272 | 648 | ||
| 1273 | (defun epg--process-filter (process input) | 649 | (defun epg--process-filter (process input) |
| 1274 | (if epg-debug | 650 | (if epg-debug |
| @@ -1346,7 +722,7 @@ This function is for internal use only." | |||
| 1346 | (if (and (epg-context-process context) | 722 | (if (and (epg-context-process context) |
| 1347 | (buffer-live-p (process-buffer (epg-context-process context)))) | 723 | (buffer-live-p (process-buffer (epg-context-process context)))) |
| 1348 | (kill-buffer (process-buffer (epg-context-process context)))) | 724 | (kill-buffer (process-buffer (epg-context-process context)))) |
| 1349 | (epg-context-set-process context nil)) | 725 | (setf (epg-context-process context) nil)) |
| 1350 | 726 | ||
| 1351 | (defun epg-delete-output-file (context) | 727 | (defun epg-delete-output-file (context) |
| 1352 | "Delete the output file of CONTEXT." | 728 | "Delete the output file of CONTEXT." |
| @@ -1540,7 +916,7 @@ This function is for internal use only." | |||
| 1540 | (if (and signature | 916 | (if (and signature |
| 1541 | (eq (epg-signature-status signature) 'error) | 917 | (eq (epg-signature-status signature) 'error) |
| 1542 | (equal (epg-signature-key-id signature) string)) | 918 | (equal (epg-signature-key-id signature) string)) |
| 1543 | (epg-signature-set-status signature 'no-pubkey))) | 919 | (setf (epg-signature-status signature) 'no-pubkey))) |
| 1544 | (epg-context-set-result-for | 920 | (epg-context-set-result-for |
| 1545 | context 'error | 921 | context 'error |
| 1546 | (cons (cons 'no-pubkey string) | 922 | (cons (cons 'no-pubkey string) |
| @@ -1567,21 +943,16 @@ This function is for internal use only." | |||
| 1567 | 'verify | 943 | 'verify |
| 1568 | (cons signature | 944 | (cons signature |
| 1569 | (epg-context-result-for context 'verify))) | 945 | (epg-context-result-for context 'verify))) |
| 1570 | (epg-signature-set-key-id | 946 | (setf (epg-signature-key-id signature) |
| 1571 | signature | 947 | (match-string 1 string)) |
| 1572 | (match-string 1 string)) | 948 | (setf (epg-signature-pubkey-algorithm signature) |
| 1573 | (epg-signature-set-pubkey-algorithm | 949 | (string-to-number (match-string 2 string))) |
| 1574 | signature | 950 | (setf (epg-signature-digest-algorithm signature) |
| 1575 | (string-to-number (match-string 2 string))) | 951 | (string-to-number (match-string 3 string))) |
| 1576 | (epg-signature-set-digest-algorithm | 952 | (setf (epg-signature-class signature) |
| 1577 | signature | 953 | (string-to-number (match-string 4 string) 16)) |
| 1578 | (string-to-number (match-string 3 string))) | 954 | (setf (epg-signature-creation-time signature) |
| 1579 | (epg-signature-set-class | 955 | (epg--time-from-seconds (match-string 5 string)))))) |
| 1580 | signature | ||
| 1581 | (string-to-number (match-string 4 string) 16)) | ||
| 1582 | (epg-signature-set-creation-time | ||
| 1583 | signature | ||
| 1584 | (epg--time-from-seconds (match-string 5 string)))))) | ||
| 1585 | 956 | ||
| 1586 | (defun epg--status-VALIDSIG (context string) | 957 | (defun epg--status-VALIDSIG (context string) |
| 1587 | (let ((signature (car (epg-context-result-for context 'verify)))) | 958 | (let ((signature (car (epg-context-result-for context 'verify)))) |
| @@ -1591,81 +962,70 @@ This function is for internal use only." | |||
| 1591 | \\([0-9]+\\) [^ ]+ \\([0-9]+\\) \\([0-9]+\\) \\([0-9A-Fa-f][0-9A-Fa-f]\\) \ | 962 | \\([0-9]+\\) [^ ]+ \\([0-9]+\\) \\([0-9]+\\) \\([0-9A-Fa-f][0-9A-Fa-f]\\) \ |
| 1592 | \\(.*\\)" | 963 | \\(.*\\)" |
| 1593 | string)) | 964 | string)) |
| 1594 | (epg-signature-set-fingerprint | 965 | (setf (epg-signature-fingerprint signature) |
| 1595 | signature | 966 | (match-string 1 string)) |
| 1596 | (match-string 1 string)) | 967 | (setf (epg-signature-creation-time signature) |
| 1597 | (epg-signature-set-creation-time | 968 | (epg--time-from-seconds (match-string 2 string))) |
| 1598 | signature | ||
| 1599 | (epg--time-from-seconds (match-string 2 string))) | ||
| 1600 | (unless (equal (match-string 3 string) "0") | 969 | (unless (equal (match-string 3 string) "0") |
| 1601 | (epg-signature-set-expiration-time | 970 | (setf (epg-signature-expiration-time signature) |
| 1602 | signature | 971 | (epg--time-from-seconds (match-string 3 string)))) |
| 1603 | (epg--time-from-seconds (match-string 3 string)))) | 972 | (setf (epg-signature-version signature) |
| 1604 | (epg-signature-set-version | 973 | (string-to-number (match-string 4 string))) |
| 1605 | signature | 974 | (setf (epg-signature-pubkey-algorithm signature) |
| 1606 | (string-to-number (match-string 4 string))) | 975 | (string-to-number (match-string 5 string))) |
| 1607 | (epg-signature-set-pubkey-algorithm | 976 | (setf (epg-signature-digest-algorithm signature) |
| 1608 | signature | 977 | (string-to-number (match-string 6 string))) |
| 1609 | (string-to-number (match-string 5 string))) | 978 | (setf (epg-signature-class signature) |
| 1610 | (epg-signature-set-digest-algorithm | 979 | (string-to-number (match-string 7 string) 16))))) |
| 1611 | signature | ||
| 1612 | (string-to-number (match-string 6 string))) | ||
| 1613 | (epg-signature-set-class | ||
| 1614 | signature | ||
| 1615 | (string-to-number (match-string 7 string) 16))))) | ||
| 1616 | 980 | ||
| 1617 | (defun epg--status-TRUST_UNDEFINED (context _string) | 981 | (defun epg--status-TRUST_UNDEFINED (context _string) |
| 1618 | (let ((signature (car (epg-context-result-for context 'verify)))) | 982 | (let ((signature (car (epg-context-result-for context 'verify)))) |
| 1619 | (if (and signature | 983 | (if (and signature |
| 1620 | (eq (epg-signature-status signature) 'good)) | 984 | (eq (epg-signature-status signature) 'good)) |
| 1621 | (epg-signature-set-validity signature 'undefined)))) | 985 | (setf (epg-signature-validity signature) 'undefined)))) |
| 1622 | 986 | ||
| 1623 | (defun epg--status-TRUST_NEVER (context _string) | 987 | (defun epg--status-TRUST_NEVER (context _string) |
| 1624 | (let ((signature (car (epg-context-result-for context 'verify)))) | 988 | (let ((signature (car (epg-context-result-for context 'verify)))) |
| 1625 | (if (and signature | 989 | (if (and signature |
| 1626 | (eq (epg-signature-status signature) 'good)) | 990 | (eq (epg-signature-status signature) 'good)) |
| 1627 | (epg-signature-set-validity signature 'never)))) | 991 | (setf (epg-signature-validity signature) 'never)))) |
| 1628 | 992 | ||
| 1629 | (defun epg--status-TRUST_MARGINAL (context _string) | 993 | (defun epg--status-TRUST_MARGINAL (context _string) |
| 1630 | (let ((signature (car (epg-context-result-for context 'verify)))) | 994 | (let ((signature (car (epg-context-result-for context 'verify)))) |
| 1631 | (if (and signature | 995 | (if (and signature |
| 1632 | (eq (epg-signature-status signature) 'marginal)) | 996 | (eq (epg-signature-status signature) 'marginal)) |
| 1633 | (epg-signature-set-validity signature 'marginal)))) | 997 | (setf (epg-signature-validity signature) 'marginal)))) |
| 1634 | 998 | ||
| 1635 | (defun epg--status-TRUST_FULLY (context _string) | 999 | (defun epg--status-TRUST_FULLY (context _string) |
| 1636 | (let ((signature (car (epg-context-result-for context 'verify)))) | 1000 | (let ((signature (car (epg-context-result-for context 'verify)))) |
| 1637 | (if (and signature | 1001 | (if (and signature |
| 1638 | (eq (epg-signature-status signature) 'good)) | 1002 | (eq (epg-signature-status signature) 'good)) |
| 1639 | (epg-signature-set-validity signature 'full)))) | 1003 | (setf (epg-signature-validity signature) 'full)))) |
| 1640 | 1004 | ||
| 1641 | (defun epg--status-TRUST_ULTIMATE (context _string) | 1005 | (defun epg--status-TRUST_ULTIMATE (context _string) |
| 1642 | (let ((signature (car (epg-context-result-for context 'verify)))) | 1006 | (let ((signature (car (epg-context-result-for context 'verify)))) |
| 1643 | (if (and signature | 1007 | (if (and signature |
| 1644 | (eq (epg-signature-status signature) 'good)) | 1008 | (eq (epg-signature-status signature) 'good)) |
| 1645 | (epg-signature-set-validity signature 'ultimate)))) | 1009 | (setf (epg-signature-validity signature) 'ultimate)))) |
| 1646 | 1010 | ||
| 1647 | (defun epg--status-NOTATION_NAME (context string) | 1011 | (defun epg--status-NOTATION_NAME (context string) |
| 1648 | (let ((signature (car (epg-context-result-for context 'verify)))) | 1012 | (let ((signature (car (epg-context-result-for context 'verify)))) |
| 1649 | (if signature | 1013 | (if signature |
| 1650 | (epg-signature-set-notations | 1014 | (push (epg-make-sig-notation string nil t nil) |
| 1651 | signature | 1015 | (epg-signature-notations signature))))) |
| 1652 | (cons (epg-make-sig-notation string nil t nil) | ||
| 1653 | (epg-sig-notations signature)))))) | ||
| 1654 | 1016 | ||
| 1655 | (defun epg--status-NOTATION_DATA (context string) | 1017 | (defun epg--status-NOTATION_DATA (context string) |
| 1656 | (let ((signature (car (epg-context-result-for context 'verify))) | 1018 | (let ((signature (car (epg-context-result-for context 'verify))) |
| 1657 | notation) | 1019 | notation) |
| 1658 | (if (and signature | 1020 | (if (and signature |
| 1659 | (setq notation (car (epg-sig-notations signature)))) | 1021 | (setq notation (car (epg-signature-notations signature)))) |
| 1660 | (epg-sig-notation-set-value notation string)))) | 1022 | (setf (epg-sig-notation-value notation) string)))) |
| 1661 | 1023 | ||
| 1662 | (defun epg--status-POLICY_URL (context string) | 1024 | (defun epg--status-POLICY_URL (context string) |
| 1663 | (let ((signature (car (epg-context-result-for context 'verify)))) | 1025 | (let ((signature (car (epg-context-result-for context 'verify)))) |
| 1664 | (if signature | 1026 | (if signature |
| 1665 | (epg-signature-set-notations | 1027 | (push (epg-make-sig-notation nil string t nil) |
| 1666 | signature | 1028 | (epg-signature-notations signature))))) |
| 1667 | (cons (epg-make-sig-notation nil string t nil) | ||
| 1668 | (epg-sig-notations signature)))))) | ||
| 1669 | 1029 | ||
| 1670 | (defun epg--status-PROGRESS (context string) | 1030 | (defun epg--status-PROGRESS (context string) |
| 1671 | (if (and (epg-context-progress-callback context) | 1031 | (if (and (epg-context-progress-callback context) |
| @@ -1944,15 +1304,11 @@ NAME is either a string or a list of strings." | |||
| 1944 | (cdr (assq (string-to-char (aref (car lines) 8)) | 1304 | (cdr (assq (string-to-char (aref (car lines) 8)) |
| 1945 | epg-key-validity-alist)))) | 1305 | epg-key-validity-alist)))) |
| 1946 | keys)) | 1306 | keys)) |
| 1947 | (epg-key-set-sub-key-list | 1307 | (push (epg--make-sub-key-1 (car lines)) |
| 1948 | (car keys) | 1308 | (epg-key-sub-key-list (car keys)))) |
| 1949 | (cons (epg--make-sub-key-1 (car lines)) | ||
| 1950 | (epg-key-sub-key-list (car keys))))) | ||
| 1951 | ((member (aref (car lines) 0) '("sub" "ssb")) | 1309 | ((member (aref (car lines) 0) '("sub" "ssb")) |
| 1952 | (epg-key-set-sub-key-list | 1310 | (push (epg--make-sub-key-1 (car lines)) |
| 1953 | (car keys) | 1311 | (epg-key-sub-key-list (car keys)))) |
| 1954 | (cons (epg--make-sub-key-1 (car lines)) | ||
| 1955 | (epg-key-sub-key-list (car keys))))) | ||
| 1956 | ((equal (aref (car lines) 0) "uid") | 1312 | ((equal (aref (car lines) 0) "uid") |
| 1957 | ;; Decode the UID name as a backslash escaped UTF-8 string, | 1313 | ;; Decode the UID name as a backslash escaped UTF-8 string, |
| 1958 | ;; generated by GnuPG/GpgSM. | 1314 | ;; generated by GnuPG/GpgSM. |
| @@ -1967,52 +1323,42 @@ NAME is either a string or a list of strings." | |||
| 1967 | 'utf-8)) | 1323 | 'utf-8)) |
| 1968 | (error | 1324 | (error |
| 1969 | (setq string (aref (car lines) 9)))) | 1325 | (setq string (aref (car lines) 9)))) |
| 1970 | (epg-key-set-user-id-list | 1326 | (push (epg-make-user-id |
| 1971 | (car keys) | 1327 | (if (aref (car lines) 1) |
| 1972 | (cons (epg-make-user-id | 1328 | (cdr (assq (string-to-char (aref (car lines) 1)) |
| 1973 | (if (aref (car lines) 1) | 1329 | epg-key-validity-alist))) |
| 1974 | (cdr (assq (string-to-char (aref (car lines) 1)) | 1330 | (if cert |
| 1975 | epg-key-validity-alist))) | 1331 | (condition-case nil |
| 1976 | (if cert | 1332 | (epg-dn-from-string string) |
| 1977 | (condition-case nil | 1333 | (error string)) |
| 1978 | (epg-dn-from-string string) | 1334 | string)) |
| 1979 | (error string)) | 1335 | (epg-key-user-id-list (car keys)))) |
| 1980 | string)) | ||
| 1981 | (epg-key-user-id-list (car keys))))) | ||
| 1982 | ((equal (aref (car lines) 0) "fpr") | 1336 | ((equal (aref (car lines) 0) "fpr") |
| 1983 | (epg-sub-key-set-fingerprint (car (epg-key-sub-key-list (car keys))) | 1337 | (setf (epg-sub-key-fingerprint (car (epg-key-sub-key-list (car keys)))) |
| 1984 | (aref (car lines) 9))) | 1338 | (aref (car lines) 9))) |
| 1985 | ((equal (aref (car lines) 0) "sig") | 1339 | ((equal (aref (car lines) 0) "sig") |
| 1986 | (epg-user-id-set-signature-list | 1340 | (push |
| 1987 | (car (epg-key-user-id-list (car keys))) | 1341 | (epg-make-key-signature |
| 1988 | (cons | 1342 | (if (aref (car lines) 1) |
| 1989 | (epg-make-key-signature | 1343 | (cdr (assq (string-to-char (aref (car lines) 1)) |
| 1990 | (if (aref (car lines) 1) | 1344 | epg-key-validity-alist))) |
| 1991 | (cdr (assq (string-to-char (aref (car lines) 1)) | 1345 | (string-to-number (aref (car lines) 3)) |
| 1992 | epg-key-validity-alist))) | 1346 | (aref (car lines) 4) |
| 1993 | (string-to-number (aref (car lines) 3)) | 1347 | (epg--time-from-seconds (aref (car lines) 5)) |
| 1994 | (aref (car lines) 4) | 1348 | (epg--time-from-seconds (aref (car lines) 6)) |
| 1995 | (epg--time-from-seconds (aref (car lines) 5)) | 1349 | (aref (car lines) 9) |
| 1996 | (epg--time-from-seconds (aref (car lines) 6)) | 1350 | (string-to-number (aref (car lines) 10) 16) |
| 1997 | (aref (car lines) 9) | 1351 | (eq (aref (aref (car lines) 10) 2) ?x)) |
| 1998 | (string-to-number (aref (car lines) 10) 16) | 1352 | (epg-user-id-signature-list |
| 1999 | (eq (aref (aref (car lines) 10) 2) ?x)) | 1353 | (car (epg-key-user-id-list (car keys))))))) |
| 2000 | (epg-user-id-signature-list | ||
| 2001 | (car (epg-key-user-id-list (car keys)))))))) | ||
| 2002 | (setq lines (cdr lines))) | 1354 | (setq lines (cdr lines))) |
| 2003 | (setq keys (nreverse keys) | 1355 | (setq keys (nreverse keys) |
| 2004 | pointer keys) | 1356 | pointer keys) |
| 2005 | (while pointer | 1357 | (while pointer |
| 2006 | (epg-key-set-sub-key-list | 1358 | (epg--gv-nreverse (epg-key-sub-key-list (car pointer))) |
| 2007 | (car pointer) | 1359 | (setq pointer-1 (epg--gv-nreverse (epg-key-user-id-list (car pointer)))) |
| 2008 | (nreverse (epg-key-sub-key-list (car pointer)))) | ||
| 2009 | (setq pointer-1 (epg-key-set-user-id-list | ||
| 2010 | (car pointer) | ||
| 2011 | (nreverse (epg-key-user-id-list (car pointer))))) | ||
| 2012 | (while pointer-1 | 1360 | (while pointer-1 |
| 2013 | (epg-user-id-set-signature-list | 1361 | (epg--gv-nreverse (epg-user-id-signature-list (car pointer-1))) |
| 2014 | (car pointer-1) | ||
| 2015 | (nreverse (epg-user-id-signature-list (car pointer-1)))) | ||
| 2016 | (setq pointer-1 (cdr pointer-1))) | 1362 | (setq pointer-1 (cdr pointer-1))) |
| 2017 | (setq pointer (cdr pointer))) | 1363 | (setq pointer (cdr pointer))) |
| 2018 | keys)) | 1364 | keys)) |
| @@ -2114,8 +1460,8 @@ If you are unsure, use synchronous version of this function | |||
| 2114 | `epg-decrypt-file' or `epg-decrypt-string' instead." | 1460 | `epg-decrypt-file' or `epg-decrypt-string' instead." |
| 2115 | (unless (epg-data-file cipher) | 1461 | (unless (epg-data-file cipher) |
| 2116 | (error "Not a file")) | 1462 | (error "Not a file")) |
| 2117 | (epg-context-set-operation context 'decrypt) | 1463 | (setf (epg-context-operation context) 'decrypt) |
| 2118 | (epg-context-set-result context nil) | 1464 | (setf (epg-context-result context) nil) |
| 2119 | (epg--start context (list "--decrypt" "--" (epg-data-file cipher))) | 1465 | (epg--start context (list "--decrypt" "--" (epg-data-file cipher))) |
| 2120 | ;; `gpgsm' does not read passphrase from stdin, so waiting is not needed. | 1466 | ;; `gpgsm' does not read passphrase from stdin, so waiting is not needed. |
| 2121 | (unless (eq (epg-context-protocol context) 'CMS) | 1467 | (unless (eq (epg-context-protocol context) 'CMS) |
| @@ -2135,10 +1481,8 @@ If you are unsure, use synchronous version of this function | |||
| 2135 | If PLAIN is nil, it returns the result as a string." | 1481 | If PLAIN is nil, it returns the result as a string." |
| 2136 | (unwind-protect | 1482 | (unwind-protect |
| 2137 | (progn | 1483 | (progn |
| 2138 | (if plain | 1484 | (setf (epg-context-output-file context) |
| 2139 | (epg-context-set-output-file context plain) | 1485 | (or plain (epg--make-temp-file "epg-output"))) |
| 2140 | (epg-context-set-output-file context | ||
| 2141 | (epg--make-temp-file "epg-output"))) | ||
| 2142 | (epg-start-decrypt context (epg-make-data-from-file cipher)) | 1486 | (epg-start-decrypt context (epg-make-data-from-file cipher)) |
| 2143 | (epg-wait-for-completion context) | 1487 | (epg-wait-for-completion context) |
| 2144 | (epg--check-error-for-decrypt context) | 1488 | (epg--check-error-for-decrypt context) |
| @@ -2155,8 +1499,8 @@ If PLAIN is nil, it returns the result as a string." | |||
| 2155 | (unwind-protect | 1499 | (unwind-protect |
| 2156 | (progn | 1500 | (progn |
| 2157 | (write-region cipher nil input-file nil 'quiet) | 1501 | (write-region cipher nil input-file nil 'quiet) |
| 2158 | (epg-context-set-output-file context | 1502 | (setf (epg-context-output-file context) |
| 2159 | (epg--make-temp-file "epg-output")) | 1503 | (epg--make-temp-file "epg-output")) |
| 2160 | (epg-start-decrypt context (epg-make-data-from-file input-file)) | 1504 | (epg-start-decrypt context (epg-make-data-from-file input-file)) |
| 2161 | (epg-wait-for-completion context) | 1505 | (epg-wait-for-completion context) |
| 2162 | (epg--check-error-for-decrypt context) | 1506 | (epg--check-error-for-decrypt context) |
| @@ -2178,8 +1522,8 @@ If you use this function, you will need to wait for the completion of | |||
| 2178 | `epg-reset' to clear a temporary output file. | 1522 | `epg-reset' to clear a temporary output file. |
| 2179 | If you are unsure, use synchronous version of this function | 1523 | If you are unsure, use synchronous version of this function |
| 2180 | `epg-verify-file' or `epg-verify-string' instead." | 1524 | `epg-verify-file' or `epg-verify-string' instead." |
| 2181 | (epg-context-set-operation context 'verify) | 1525 | (setf (epg-context-operation context) 'verify) |
| 2182 | (epg-context-set-result context nil) | 1526 | (setf (epg-context-result context) nil) |
| 2183 | (if signed-text | 1527 | (if signed-text |
| 2184 | ;; Detached signature. | 1528 | ;; Detached signature. |
| 2185 | (if (epg-data-file signed-text) | 1529 | (if (epg-data-file signed-text) |
| @@ -2226,10 +1570,8 @@ To check the verification results, use `epg-context-result-for' as follows: | |||
| 2226 | which will return a list of `epg-signature' object." | 1570 | which will return a list of `epg-signature' object." |
| 2227 | (unwind-protect | 1571 | (unwind-protect |
| 2228 | (progn | 1572 | (progn |
| 2229 | (if plain | 1573 | (setf (epg-context-output-file context) |
| 2230 | (epg-context-set-output-file context plain) | 1574 | (or plain (epg--make-temp-file "epg-output"))) |
| 2231 | (epg-context-set-output-file context | ||
| 2232 | (epg--make-temp-file "epg-output"))) | ||
| 2233 | (if signed-text | 1575 | (if signed-text |
| 2234 | (epg-start-verify context | 1576 | (epg-start-verify context |
| 2235 | (epg-make-data-from-file signature) | 1577 | (epg-make-data-from-file signature) |
| @@ -2265,8 +1607,8 @@ which will return a list of `epg-signature' object." | |||
| 2265 | input-file) | 1607 | input-file) |
| 2266 | (unwind-protect | 1608 | (unwind-protect |
| 2267 | (progn | 1609 | (progn |
| 2268 | (epg-context-set-output-file context | 1610 | (setf (epg-context-output-file context) |
| 2269 | (epg--make-temp-file "epg-output")) | 1611 | (epg--make-temp-file "epg-output")) |
| 2270 | (if signed-text | 1612 | (if signed-text |
| 2271 | (progn | 1613 | (progn |
| 2272 | (setq input-file (epg--make-temp-file "epg-signature")) | 1614 | (setq input-file (epg--make-temp-file "epg-signature")) |
| @@ -2296,8 +1638,8 @@ If you use this function, you will need to wait for the completion of | |||
| 2296 | `epg-reset' to clear a temporary output file. | 1638 | `epg-reset' to clear a temporary output file. |
| 2297 | If you are unsure, use synchronous version of this function | 1639 | If you are unsure, use synchronous version of this function |
| 2298 | `epg-sign-file' or `epg-sign-string' instead." | 1640 | `epg-sign-file' or `epg-sign-string' instead." |
| 2299 | (epg-context-set-operation context 'sign) | 1641 | (setf (epg-context-operation context) 'sign) |
| 2300 | (epg-context-set-result context nil) | 1642 | (setf (epg-context-result context) nil) |
| 2301 | (unless (memq mode '(t detached nil normal)) ;i.e. cleartext | 1643 | (unless (memq mode '(t detached nil normal)) ;i.e. cleartext |
| 2302 | (epg-context-set-armor context nil) | 1644 | (epg-context-set-armor context nil) |
| 2303 | (epg-context-set-textmode context nil)) | 1645 | (epg-context-set-textmode context nil)) |
| @@ -2336,10 +1678,8 @@ If it is nil or 'normal, it makes a normal signature. | |||
| 2336 | Otherwise, it makes a cleartext signature." | 1678 | Otherwise, it makes a cleartext signature." |
| 2337 | (unwind-protect | 1679 | (unwind-protect |
| 2338 | (progn | 1680 | (progn |
| 2339 | (if signature | 1681 | (setf (epg-context-output-file context) |
| 2340 | (epg-context-set-output-file context signature) | 1682 | (or signature (epg--make-temp-file "epg-output"))) |
| 2341 | (epg-context-set-output-file context | ||
| 2342 | (epg--make-temp-file "epg-output"))) | ||
| 2343 | (epg-start-sign context (epg-make-data-from-file plain) mode) | 1683 | (epg-start-sign context (epg-make-data-from-file plain) mode) |
| 2344 | (epg-wait-for-completion context) | 1684 | (epg-wait-for-completion context) |
| 2345 | (unless (epg-context-result-for context 'sign) | 1685 | (unless (epg-context-result-for context 'sign) |
| @@ -2368,8 +1708,8 @@ Otherwise, it makes a cleartext signature." | |||
| 2368 | (coding-system-for-write 'binary)) | 1708 | (coding-system-for-write 'binary)) |
| 2369 | (unwind-protect | 1709 | (unwind-protect |
| 2370 | (progn | 1710 | (progn |
| 2371 | (epg-context-set-output-file context | 1711 | (setf (epg-context-output-file context) |
| 2372 | (epg--make-temp-file "epg-output")) | 1712 | (epg--make-temp-file "epg-output")) |
| 2373 | (if input-file | 1713 | (if input-file |
| 2374 | (write-region plain nil input-file nil 'quiet)) | 1714 | (write-region plain nil input-file nil 'quiet)) |
| 2375 | (epg-start-sign context | 1715 | (epg-start-sign context |
| @@ -2400,8 +1740,8 @@ If you use this function, you will need to wait for the completion of | |||
| 2400 | `epg-reset' to clear a temporary output file. | 1740 | `epg-reset' to clear a temporary output file. |
| 2401 | If you are unsure, use synchronous version of this function | 1741 | If you are unsure, use synchronous version of this function |
| 2402 | `epg-encrypt-file' or `epg-encrypt-string' instead." | 1742 | `epg-encrypt-file' or `epg-encrypt-string' instead." |
| 2403 | (epg-context-set-operation context 'encrypt) | 1743 | (setf (epg-context-operation context) 'encrypt) |
| 2404 | (epg-context-set-result context nil) | 1744 | (setf (epg-context-result context) nil) |
| 2405 | (epg--start context | 1745 | (epg--start context |
| 2406 | (append (if always-trust '("--always-trust")) | 1746 | (append (if always-trust '("--always-trust")) |
| 2407 | (if recipients '("--encrypt") '("--symmetric")) | 1747 | (if recipients '("--encrypt") '("--symmetric")) |
| @@ -2445,10 +1785,8 @@ If CIPHER is nil, it returns the result as a string. | |||
| 2445 | If RECIPIENTS is nil, it performs symmetric encryption." | 1785 | If RECIPIENTS is nil, it performs symmetric encryption." |
| 2446 | (unwind-protect | 1786 | (unwind-protect |
| 2447 | (progn | 1787 | (progn |
| 2448 | (if cipher | 1788 | (setf (epg-context-output-file context) |
| 2449 | (epg-context-set-output-file context cipher) | 1789 | (or cipher (epg--make-temp-file "epg-output"))) |
| 2450 | (epg-context-set-output-file context | ||
| 2451 | (epg--make-temp-file "epg-output"))) | ||
| 2452 | (epg-start-encrypt context (epg-make-data-from-file plain) | 1790 | (epg-start-encrypt context (epg-make-data-from-file plain) |
| 2453 | recipients sign always-trust) | 1791 | recipients sign always-trust) |
| 2454 | (epg-wait-for-completion context) | 1792 | (epg-wait-for-completion context) |
| @@ -2482,8 +1820,8 @@ If RECIPIENTS is nil, it performs symmetric encryption." | |||
| 2482 | (coding-system-for-write 'binary)) | 1820 | (coding-system-for-write 'binary)) |
| 2483 | (unwind-protect | 1821 | (unwind-protect |
| 2484 | (progn | 1822 | (progn |
| 2485 | (epg-context-set-output-file context | 1823 | (setf (epg-context-output-file context) |
| 2486 | (epg--make-temp-file "epg-output")) | 1824 | (epg--make-temp-file "epg-output")) |
| 2487 | (if input-file | 1825 | (if input-file |
| 2488 | (write-region plain nil input-file nil 'quiet)) | 1826 | (write-region plain nil input-file nil 'quiet)) |
| 2489 | (epg-start-encrypt context | 1827 | (epg-start-encrypt context |
| @@ -2514,8 +1852,8 @@ If you use this function, you will need to wait for the completion of | |||
| 2514 | `epg-reset' to clear a temporary output file. | 1852 | `epg-reset' to clear a temporary output file. |
| 2515 | If you are unsure, use synchronous version of this function | 1853 | If you are unsure, use synchronous version of this function |
| 2516 | `epg-export-keys-to-file' or `epg-export-keys-to-string' instead." | 1854 | `epg-export-keys-to-file' or `epg-export-keys-to-string' instead." |
| 2517 | (epg-context-set-operation context 'export-keys) | 1855 | (setf (epg-context-operation context) 'export-keys) |
| 2518 | (epg-context-set-result context nil) | 1856 | (setf (epg-context-result context) nil) |
| 2519 | (epg--start context (cons "--export" | 1857 | (epg--start context (cons "--export" |
| 2520 | (mapcar | 1858 | (mapcar |
| 2521 | (lambda (key) | 1859 | (lambda (key) |
| @@ -2527,10 +1865,8 @@ If you are unsure, use synchronous version of this function | |||
| 2527 | "Extract public KEYS." | 1865 | "Extract public KEYS." |
| 2528 | (unwind-protect | 1866 | (unwind-protect |
| 2529 | (progn | 1867 | (progn |
| 2530 | (if file | 1868 | (setf (epg-context-output-file context) |
| 2531 | (epg-context-set-output-file context file) | 1869 | (or file (epg--make-temp-file "epg-output"))) |
| 2532 | (epg-context-set-output-file context | ||
| 2533 | (epg--make-temp-file "epg-output"))) | ||
| 2534 | (epg-start-export-keys context keys) | 1870 | (epg-start-export-keys context keys) |
| 2535 | (epg-wait-for-completion context) | 1871 | (epg-wait-for-completion context) |
| 2536 | (let ((errors (epg-context-result-for context 'error))) | 1872 | (let ((errors (epg-context-result-for context 'error))) |
| @@ -2557,8 +1893,8 @@ If you use this function, you will need to wait for the completion of | |||
| 2557 | `epg-reset' to clear a temporary output file. | 1893 | `epg-reset' to clear a temporary output file. |
| 2558 | If you are unsure, use synchronous version of this function | 1894 | If you are unsure, use synchronous version of this function |
| 2559 | `epg-import-keys-from-file' or `epg-import-keys-from-string' instead." | 1895 | `epg-import-keys-from-file' or `epg-import-keys-from-string' instead." |
| 2560 | (epg-context-set-operation context 'import-keys) | 1896 | (setf (epg-context-operation context) 'import-keys) |
| 2561 | (epg-context-set-result context nil) | 1897 | (setf (epg-context-result context) nil) |
| 2562 | (epg--start context (if (epg-data-file keys) | 1898 | (epg--start context (if (epg-data-file keys) |
| 2563 | (list "--import" "--" (epg-data-file keys)) | 1899 | (list "--import" "--" (epg-data-file keys)) |
| 2564 | (list "--import"))) | 1900 | (list "--import"))) |
| @@ -2598,8 +1934,8 @@ If you use this function, you will need to wait for the completion of | |||
| 2598 | `epg-reset' to clear a temporary output file. | 1934 | `epg-reset' to clear a temporary output file. |
| 2599 | If you are unsure, use synchronous version of this function | 1935 | If you are unsure, use synchronous version of this function |
| 2600 | `epg-receive-keys' instead." | 1936 | `epg-receive-keys' instead." |
| 2601 | (epg-context-set-operation context 'receive-keys) | 1937 | (setf (epg-context-operation context) 'receive-keys) |
| 2602 | (epg-context-set-result context nil) | 1938 | (setf (epg-context-result context) nil) |
| 2603 | (epg--start context (cons "--recv-keys" key-id-list))) | 1939 | (epg--start context (cons "--recv-keys" key-id-list))) |
| 2604 | 1940 | ||
| 2605 | (defun epg-receive-keys (context keys) | 1941 | (defun epg-receive-keys (context keys) |
| @@ -2626,8 +1962,8 @@ If you use this function, you will need to wait for the completion of | |||
| 2626 | `epg-reset' to clear a temporary output file. | 1962 | `epg-reset' to clear a temporary output file. |
| 2627 | If you are unsure, use synchronous version of this function | 1963 | If you are unsure, use synchronous version of this function |
| 2628 | `epg-delete-keys' instead." | 1964 | `epg-delete-keys' instead." |
| 2629 | (epg-context-set-operation context 'delete-keys) | 1965 | (setf (epg-context-operation context) 'delete-keys) |
| 2630 | (epg-context-set-result context nil) | 1966 | (setf (epg-context-result context) nil) |
| 2631 | (epg--start context (cons (if allow-secret | 1967 | (epg--start context (cons (if allow-secret |
| 2632 | "--delete-secret-key" | 1968 | "--delete-secret-key" |
| 2633 | "--delete-key") | 1969 | "--delete-key") |
| @@ -2659,8 +1995,8 @@ If you use this function, you will need to wait for the completion of | |||
| 2659 | If you are unsure, use synchronous version of this function | 1995 | If you are unsure, use synchronous version of this function |
| 2660 | `epg-sign-keys' instead." | 1996 | `epg-sign-keys' instead." |
| 2661 | (declare (obsolete nil "23.1")) | 1997 | (declare (obsolete nil "23.1")) |
| 2662 | (epg-context-set-operation context 'sign-keys) | 1998 | (setf (epg-context-operation context) 'sign-keys) |
| 2663 | (epg-context-set-result context nil) | 1999 | (setf (epg-context-result context) nil) |
| 2664 | (epg--start context (cons (if local | 2000 | (epg--start context (cons (if local |
| 2665 | "--lsign-key" | 2001 | "--lsign-key" |
| 2666 | "--sign-key") | 2002 | "--sign-key") |
| @@ -2693,8 +2029,8 @@ If you use this function, you will need to wait for the completion of | |||
| 2693 | `epg-reset' to clear a temporary output file. | 2029 | `epg-reset' to clear a temporary output file. |
| 2694 | If you are unsure, use synchronous version of this function | 2030 | If you are unsure, use synchronous version of this function |
| 2695 | `epg-generate-key-from-file' or `epg-generate-key-from-string' instead." | 2031 | `epg-generate-key-from-file' or `epg-generate-key-from-string' instead." |
| 2696 | (epg-context-set-operation context 'generate-key) | 2032 | (setf (epg-context-operation context) 'generate-key) |
| 2697 | (epg-context-set-result context nil) | 2033 | (setf (epg-context-result context) nil) |
| 2698 | (if (epg-data-file parameters) | 2034 | (if (epg-data-file parameters) |
| 2699 | (epg--start context (list "--batch" "--genkey" "--" | 2035 | (epg--start context (list "--batch" "--genkey" "--" |
| 2700 | (epg-data-file parameters))) | 2036 | (epg-data-file parameters))) |