Commit 7b97a7a5 authored by Reiner Steib's avatar Reiner Steib
Browse files

Sync with version from Gnus (only whitespace changes).

parent 6c3ba921
......@@ -163,24 +163,22 @@ Optional ALL non-nil means search all keys, including secret keys."
(let ((args (list "--with-colons" "--no-greeting" "--batch"
(if all "--list-secret-keys" "--list-keys")
string))
(key-regexp (concat "^\\(sec\\|pub\\)"
":[^:]*:[^:]*:[^:]*:\\([^:]*\\):[^:]*"
":[^:]*:[^:]*:[^:]*:\\([^:]*\\):"))
)
(key-regexp (concat "^\\(sec\\|pub\\)"
":[^:]*:[^:]*:[^:]*:\\([^:]*\\):[^:]*"
":[^:]*:[^:]*:[^:]*:\\([^:]*\\):")))
(with-temp-buffer
(apply #'call-process pgg-gpg-program nil t nil args)
(goto-char (point-min))
(if (re-search-forward key-regexp
nil t)
(match-string 3)))))
nil t)
(match-string 3)))))
(defun pgg-gpg-key-id-from-key-owner (key-owner)
(cond ((not key-owner) nil)
;; Extract bare key id from outermost paired angle brackets, if any:
((string-match "[^<]*<\\(.+\\)>[^>]*" key-owner)
(substring key-owner (match-beginning 1)(match-end 1)))
(key-owner))
)
;; Extract bare key id from outermost paired angle brackets, if any:
((string-match "[^<]*<\\(.+\\)>[^>]*" key-owner)
(substring key-owner (match-beginning 1)(match-end 1)))
(key-owner)))
(defun pgg-gpg-encrypt-region (start end recipients &optional sign passphrase)
"Encrypt the current region between START and END.
......@@ -242,15 +240,15 @@ passphrase cache or user."
(insert-buffer-substring current-buffer)
(pgg-decode-armor-region (point-min) (point-max))))
(secret-keys (pgg-gpg-lookup-all-secret-keys))
;; XXX the user is stuck if they need to use the passphrase for
;; any but the first secret key for which the message is
;; encrypted. ideally, we would incrementally give them a
;; chance with subsequent keys each time they fail with one.
;; XXX the user is stuck if they need to use the passphrase for
;; any but the first secret key for which the message is
;; encrypted. ideally, we would incrementally give them a
;; chance with subsequent keys each time they fail with one.
(key (pgg-gpg-select-matching-key message-keys secret-keys))
(key-owner (and key (pgg-gpg-lookup-key-owner key t)))
(key-owner (and key (pgg-gpg-lookup-key-owner key t)))
(key-id (pgg-gpg-key-id-from-key-owner key-owner))
(pgg-gpg-user-id (or key-id key
pgg-gpg-user-id pgg-default-user-id))
pgg-gpg-user-id pgg-default-user-id))
(passphrase (or passphrase
(when (not pgg-gpg-use-agent)
(pgg-read-passphrase
......@@ -280,7 +278,7 @@ passphrase cache or user."
(loop for message-key in message-keys
for message-key-id = (and (equal (car message-key) 1)
(cdr (assq 'key-identifier
(cdr message-key))))
(cdr message-key))))
for key = (and message-key-id (pgg-lookup-key message-key-id 'encrypt))
when (and key (member key secret-keys)) return key))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment