1 ;;; epa-dired.el --- the EasyPG Assistant as a dired extension
2 ;; Copyright (C) 2006 Daiki Ueno
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Keywords: PGP, GnuPG
7 ;; This file is part of EasyPG.
9 ;; This program is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; This program is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
30 (let ((keymap (make-sparse-keymap)))
31 (define-key keymap "d" 'epa-dired-do-decrypt)
32 (define-key keymap "v" 'epa-dired-do-verify)
33 (define-key keymap "s" 'epa-dired-do-sign)
34 (define-key keymap "e" 'epa-dired-do-encrypt)
37 (fset 'epa-dired-prefix epa-dired-map)
39 (defun epa-dired-mode-hook ()
40 (define-key dired-mode-map ":" 'epa-dired-prefix))
42 (defun epa-dired-do-decrypt ()
43 "Decrypt marked files."
45 (let ((file-list (dired-get-marked-files)))
47 (epa-decrypt-file (expand-file-name (car file-list)))
48 (setq file-list (cdr file-list)))
51 (defun epa-dired-do-verify ()
52 "Verify marked files."
54 (let ((file-list (dired-get-marked-files)))
56 (epa-verify-file (expand-file-name (car file-list)))
57 (setq file-list (cdr file-list)))))
59 (defun epa-dired-do-sign ()
62 (let ((file-list (dired-get-marked-files)))
64 (epa-sign-file (expand-file-name (car file-list))
65 (y-or-n-p "Make a detached signature? "))
66 (setq file-list (cdr file-list)))
69 (defun epa-dired-do-encrypt ()
70 "Encrypt marked files."
72 (let ((file-list (dired-get-marked-files)))
75 (expand-file-name (car file-list))
78 (car (epg-key-sub-key-list key))))
79 (epa-select-keys "Select recipents for encryption.
80 If no one is selected, symmetric encryption will be performed. ")))
81 (setq file-list (cdr file-list)))
86 ;;; epa-dired.el ends here