* epa.el (epa-keys-mode-map): Bind epa-list-keys; epa-import-key.
authorueno <ueno>
Tue, 18 Apr 2006 09:31:42 +0000 (09:31 +0000)
committerueno <ueno>
Tue, 18 Apr 2006 09:31:42 +0000 (09:31 +0000)
(epa-import-key): New command.

ChangeLog
epa.el

index 42cd156..5524973 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-04-18  Daiki Ueno  <ueno@unixuser.org>
 
+       * epa.el (epa-keys-mode-map): Bind epa-list-keys; epa-import-key.
+       (epa-import-key): New command.
+
        * epg.el (epg-delete-problem-alist): New constant.
        (epg-status-DELETE_PROBLEM): New function.
        (epg-start-delete-key): New function.
diff --git a/epa.el b/epa.el
index ec65290..da9e000 100644 (file)
--- a/epa.el
+++ b/epa.el
     (define-key keymap "s" 'epa-sign-file)
     (define-key keymap "e" 'epa-encrypt-file)
     (define-key keymap "r" 'epa-delete-key)
+    (define-key keymap "i" 'epa-import-key)
+    (define-key keymap "g" 'epa-list-keys)
     (define-key keymap "n" 'next-line)
     (define-key keymap "p" 'previous-line)
     (define-key keymap " " 'scroll-up)
 ;;;###autoload
 (defun epa-list-keys (&optional name mode)
   (interactive
-   (let ((name (read-string "Pattern: ")))
-     (list (if (equal name "") nil name)
-          current-prefix-arg)))
+   (if current-prefix-arg
+       (let ((name (read-string "Pattern: "
+                               (if epa-list-keys-arguments
+                                   (car epa-list-keys-arguments)))))
+        (list (if (equal name "") nil name)
+              (y-or-n-p "Secret keys? ")))
+     (or epa-list-keys-arguments (list nil nil))))
   (unless (and epa-keys-buffer
               (buffer-live-p epa-keys-buffer))
     (setq epa-keys-buffer (generate-new-buffer "*Keys*")))
@@ -478,6 +484,14 @@ If no one is selected, symmetric encryption will be performed.  "))))
     (message "Deleting %s...done"
             (epg-sub-key-id (car (epg-key-sub-key-list key))))))
 
+(defun epa-import-key (file)
+  (interactive "sFile: ")
+  (let ((context (epg-make-context)))
+    (message "Importing %s..." (file-name-nondirectory file))
+    (epg-import-key context file)
+    (apply #'epa-list-keys epa-list-keys-arguments)
+    (message "Importing %s...done" (file-name-nondirectory file))))
+
 (provide 'epa)
 
 ;;; epa.el ends here