(delete-window (get-buffer-window epa-keys-buffer)))
(kill-buffer epa-keys-buffer))))
+(defun epa--format-fingerprint-1 (fingerprint unit-size block-size)
+ (let ((unit 0))
+ (with-temp-buffer
+ (insert fingerprint)
+ (goto-char (point-min))
+ (while (progn
+ (goto-char (+ (point) unit-size))
+ (not (eobp)))
+ (setq unit (1+ unit))
+ (insert (if (= (% unit block-size) 0) " " " ")))
+ (buffer-string))))
+
+(defun epa--format-fingerprint (fingerprint)
+ (if fingerprint
+ (if (= (length fingerprint) 40)
+ ;; 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678
+ (epa--format-fingerprint-1 fingerprint 4 5)
+ ;; 12 34 56 78 9A BC DE F0 12 34 56 78 9A BC DE F0
+ (epa--format-fingerprint-1 fingerprint 2 8))))
+
(defun epa--show-key (key)
(let* ((primary-sub-key (car (epg-key-sub-key-list key)))
(entry (assoc (epg-sub-key-id primary-sub-key)
(epg-sub-key-capability (car pointer))
" ")
"\n\tFingerprint: "
- (epg-sub-key-fingerprint (car pointer))
+ (epa--format-fingerprint (epg-sub-key-fingerprint (car pointer)))
"\n")
(setq pointer (cdr pointer)))
(goto-char (point-min))
"Sign FILE by SIGNERS keys selected."
(interactive
(list (expand-file-name (read-file-name "File: "))
- (epa-select-keys (epg-make-context epa-protocol)
- "Select keys for signing.
+ (if current-prefix-arg
+ (epa-select-keys (epg-make-context epa-protocol)
+ "Select keys for signing.
If no one is selected, default secret key is used. "
- nil t)
- (catch 'done
- (while t
- (message "Signature type (n,c,d,?) ")
- (let ((c (read-char)))
- (cond ((eq c ?c)
- (throw 'done 'clear))
- ((eq c ?d)
- (throw 'done 'detached))
- ((eq c ??)
- (with-output-to-temp-buffer "*Help*"
- (save-excursion
- (set-buffer standard-output)
- (insert "\
+ nil t))
+ (if current-prefix-arg
+ (catch 'done
+ (while t
+ (message "Signature type (n,c,d,?) ")
+ (let ((c (read-char)))
+ (cond ((eq c ?c)
+ (throw 'done 'clear))
+ ((eq c ?d)
+ (throw 'done 'detached))
+ ((eq c ??)
+ (with-output-to-temp-buffer "*Help*"
+ (save-excursion
+ (set-buffer standard-output)
+ (insert "\
n - Create a normal signature
c - Create a cleartext signature
d - Create a detached signature
? - Show this help
"))))
- (t
- (throw 'done nil))))))))
+ (t
+ (throw 'done nil))))))
+ 'clear)))
(let ((signature (concat file
(if (eq epa-protocol 'OpenPGP)
(if (or epa-armor
(epa--select-safe-coding-system
(region-beginning) (region-end))))
(list (region-beginning) (region-end)
- (epa-select-keys (epg-make-context epa-protocol)
- "Select keys for signing.
+ (if current-prefix-arg
+ (epa-select-keys (epg-make-context epa-protocol)
+ "Select keys for signing.
If no one is selected, default secret key is used. "
- nil t)
- (catch 'done
- (while t
- (message "Signature type (n,c,d,?) ")
- (let ((c (read-char)))
- (cond ((eq c ?c)
- (throw 'done 'clear))
- ((eq c ?d)
- (throw 'done 'detached))
- ((eq c ??)
- (with-output-to-temp-buffer "*Help*"
- (save-excursion
- (set-buffer standard-output)
- (insert "\
+ nil t))
+ (if current-prefix-arg
+ (catch 'done
+ (while t
+ (message "Signature type (n,c,d,?) ")
+ (let ((c (read-char)))
+ (cond ((eq c ?c)
+ (throw 'done 'clear))
+ ((eq c ?d)
+ (throw 'done 'detached))
+ ((eq c ??)
+ (with-output-to-temp-buffer "*Help*"
+ (save-excursion
+ (set-buffer standard-output)
+ (insert "\
n - Create a normal signature
c - Create a cleartext signature
d - Create a detached signature
? - Show this help
"))))
- (t
- (throw 'done nil)))))))))
+ (t
+ (throw 'done nil))))))
+ 'clear))))
(save-excursion
(let ((context (epg-make-context epa-protocol))
signature)