+;;; epg-file.el --- transparent file encryption utility
+;; Copyright (C) 1999, 2000, 2002, 2003, 2004,
+;; 2005, 2006 Free Software Foundation, Inc.
+;; Copyright (C) 2006 Daiki Ueno
+
+;; Author: Daiki Ueno <ueno@unixuser.org>
+;; Naoto Morishima <naoto@morishima.net>
+;; Keywords: PGP, GnuPG
+
+;; This file is part of EasyPG.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; epg-file.el is based on hedgehog.el by Naoto Morishima.
+;; http://www.morishima.net/~naoto/software/hedgehog/index.php.ja
+
+;;; Code:
+
(require 'epg)
+(defgroup epg-file ()
+ "Transparent file encryption utility of EasyPG."
+ :group 'epg)
+
(defcustom epg-file-name-regexp "\\.gpg\\'"
"Regexp that matches filenames that are assumed to be encrypted
with GnuPG."
(epg-file-run-real-handler
'write-region (list start end "/"))
(file-error (if (boundp 'last-coding-system-used)
- last-coding-system-used))))
+ last-coding-system-used
+ buffer-file-coding-system))))
;; start and end are normally buffer positions
;; specifying the part of the buffer to write.
;; If start is nil, that means to use the entire buffer contents.
(let ((coding-system-for-write 'binary)
(coding-system-for-read 'binary)
(context (epg-make-context))
+ recipients
+ string
cipher)
- (when (setq cipher (epg-encrypt-string context (buffer-string) nil))
+ (while (not (equal (setq string
+ (read-string "To (end with an empty line): "))
+ ""))
+ (setq recipients (cons string recipients)))
+ (when (setq cipher (epg-encrypt-string context (buffer-string)
+ recipients))
(if (and (memq system-type '(ms-dos windows-nt))
(boundp 'buffer-file-type))
(setq buffer-file-type t))
(when (or (eq visit t) (stringp visit))
(setq buffer-file-name filename)
(set-visited-file-modtime))
- (when (stringp visit)
- (setq buffer-file-name visit))
+ (if (stringp visit)
+ (setq buffer-file-name visit))
(when (or (eq visit t) (eq visit nil) (stringp visit))
(message "Wrote %s" visit-file))
(if (boundp 'last-coding-system-used)
(setq auto-mode-alist
(cons (list epg-file-name-regexp nil 'strip-suffix)
auto-mode-alist)))
+
+(provide 'epg-file)
+
+;;; epg-file.el ends here