epa-dired.el 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. ;;; epa-dired.el --- the EasyPG Assistant, dired extension -*- lexical-binding: t -*-
  2. ;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
  3. ;; Author: Daiki Ueno <ueno@unixuser.org>
  4. ;; Keywords: PGP, GnuPG
  5. ;; Package: epa
  6. ;; This file is part of GNU Emacs.
  7. ;; GNU Emacs is free software: you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation, either version 3 of the License, or
  10. ;; (at your option) any later version.
  11. ;; GNU Emacs is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;; GNU General Public License for more details.
  15. ;; You should have received a copy of the GNU General Public License
  16. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  17. ;;; Code:
  18. (require 'epa)
  19. (require 'dired)
  20. ;;;###autoload
  21. (defun epa-dired-do-decrypt ()
  22. "Decrypt marked files."
  23. (interactive)
  24. (let ((file-list (dired-get-marked-files)))
  25. (while file-list
  26. (epa-decrypt-file (expand-file-name (car file-list)))
  27. (setq file-list (cdr file-list)))
  28. (revert-buffer)))
  29. ;;;###autoload
  30. (defun epa-dired-do-verify ()
  31. "Verify marked files."
  32. (interactive)
  33. (let ((file-list (dired-get-marked-files)))
  34. (while file-list
  35. (epa-verify-file (expand-file-name (car file-list)))
  36. (setq file-list (cdr file-list)))))
  37. ;;;###autoload
  38. (defun epa-dired-do-sign ()
  39. "Sign marked files."
  40. (interactive)
  41. (let ((file-list (dired-get-marked-files)))
  42. (while file-list
  43. (epa-sign-file
  44. (expand-file-name (car file-list))
  45. (epa-select-keys (epg-make-context) "Select keys for signing.
  46. If no one is selected, default secret key is used. "
  47. nil t)
  48. (y-or-n-p "Make a detached signature? "))
  49. (setq file-list (cdr file-list)))
  50. (revert-buffer)))
  51. ;;;###autoload
  52. (defun epa-dired-do-encrypt ()
  53. "Encrypt marked files."
  54. (interactive)
  55. (let ((file-list (dired-get-marked-files)))
  56. (while file-list
  57. (epa-encrypt-file
  58. (expand-file-name (car file-list))
  59. (epa-select-keys (epg-make-context) "Select recipients for encryption.
  60. If no one is selected, symmetric encryption will be performed. "))
  61. (setq file-list (cdr file-list)))
  62. (revert-buffer)))
  63. (provide 'epa-dired)
  64. ;;; epa-dired.el ends here