(defun pgg-epg-passphrase-callback (key-id ignore)
(if (eq key-id 'SYM)
- (pgg-read-passphrase "GnuPG passphrase for symmetric encryption: ")
- (let ((passphrase
- (pgg-read-passphrase
- (format "GnuPG passphrase for %s: "
- (if entry
- (cdr entry)
- pgg-gpg-key-id))
- (if (eq pgg-gpg-key-id 'PIN)
- "PIN"
- pgg-gpg-key-id))))
+ (epg-passphrase-callback-function key-id nil)
+ (let* ((entry (assoc key-id epg-user-id-alist))
+ (passphrase
+ (pgg-read-passphrase
+ (format "GnuPG passphrase for %s: "
+ (if entry
+ (cdr entry)
+ key-id))
+ (if (eq key-id 'PIN)
+ "PIN"
+ key-id))))
(when passphrase
(pgg-add-passphrase-to-cache key-id passphrase)
- (copy-sequence passphrase)
(setq pgg-epg-secret-key-id-list
- (cons key-id pgg-epg-secret-key-id-list))))))
+ (cons key-id pgg-epg-secret-key-id-list))
+ (copy-sequence passphrase)))))
(defun pgg-epg-encrypt-region (start end recipients &optional sign passphrase)
"This function is for internal use only.
(if pgg-encrypt-for-me
(cons pgg-default-user-id recipients)
recipients)
- sign t))
+ sign t)
+ pgg-epg-secret-key-id-list nil)
(error
(while pgg-epg-secret-key-id-list
(pgg-remove-passphrase-from-cache (car pgg-epg-secret-key-id-list))
(epg-context-set-textmode context pgg-text-mode)
(epg-context-set-passphrase-callback context #'pgg-epg-passphrase-callback)
(condition-case error
- (setq plain (epg-decrypt-string context (buffer-substring start end)))
+ (setq plain (epg-decrypt-string context (buffer-substring start end))
+ pgg-epg-secret-key-id-list nil)
(error
(while pgg-epg-secret-key-id-list
(pgg-remove-passphrase-from-cache (car pgg-epg-secret-key-id-list))
(buffer-substring start end)
(if cleartext
'clearsign
- 'detached)))
+ 'detached))
+ pgg-epg-secret-key-id-list nil)
(error
(while pgg-epg-secret-key-id-list
(pgg-remove-passphrase-from-cache (car pgg-epg-secret-key-id-list))