unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Sascha Wilde <wilde@sha-bang.de>
Cc: "sascha schwab \(symmetric encryption patches\)" <schwab@suse.de>,
	Ken Manheimer <ken.manheimer@gmail.com>,
	"Daiki Ueno \(pgg author\)" <ueno@unixuser.org>,
	"Richard M. Stallman" <rms@gnu.org>,
	emacs-devel@gnu.org
Subject: Re: pgg symmetric encryption patch
Date: Sat, 8 Oct 2005 12:36:27 +0200	[thread overview]
Message-ID: <20051008103627.GA1218@kenny.sha-bang.local> (raw)
In-Reply-To: <iluvf08mm1w.fsf@latte.josefsson.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 655 bytes --]

On Sat, Oct 08, 2005 at 10:48:27AM +0200, Simon Josefsson wrote:
> It seems you are making some progress here.  For simplicity, could you
> post the complete patch (preferably in unified diff format) against
> Emacs CVS you want to have installed?  Unless somebody else has
> already taken care of this...

I attached the complete patch against the latest cvs checkout.

Thanks for your help.

cheers
sascha
-- 
Sascha Wilde
"Structure is _nothing_ if it is all you got.  Skeletons _spook_ people if
 thwy try to walk around on their own.  I really wonder why XML does
 not."            -- Erik Naggum <erik@naggum.net> in comp.lang.lisp

[-- Attachment #1.1.2: emacs-pgg-symmetric.patch-04 --]
[-- Type: text/plain, Size: 7885 bytes --]

Index: man/pgg.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/man/pgg.texi,v
retrieving revision 1.5
diff -u -r1.5 pgg.texi
--- man/pgg.texi	16 Sep 2005 22:11:00 -0000	1.5
+++ man/pgg.texi	8 Oct 2005 10:31:09 -0000
@@ -98,6 +98,8 @@
 @lisp
 (autoload 'pgg-encrypt-region "pgg"
   "Encrypt the current region." t)
+(autoload 'pgg-encrypt-symmetric-region "pgg"
+  "Encrypt the current region with symmetric algorithm." t)
 (autoload 'pgg-decrypt-region "pgg"
   "Decrypt the current region." t)
 (autoload 'pgg-sign-region "pgg"
@@ -140,6 +142,13 @@
 with GnuPG.
 @end deffn
 
+@deffn Command pgg-encrypt-symmetric-region start end
+Encrypt the current region between @var{start} and @var{end} using a
+symmetric cipher.  After invocation you are asked for a passphrase.
+
+This is currently only implemented for GnuPG.
+@end deffn
+
 @deffn Command pgg-decrypt-region start end
 Decrypt the current region between @var{start} and @var{end}.  If
 decryption is successful, it replaces the current region contents (in
@@ -305,6 +314,13 @@
 @var{recipients}.  If @var{sign} is non-@code{nil}, do a combined sign
 and encrypt.  If encryption is successful, it returns @code{t},
 otherwise @code{nil}.
+@end deffn
+
+@deffn Method pgg-scheme-encrypt-symmetric-region scheme start end
+Encrypt the current region between @var{start} and @var{end} using a
+symmetric cipher and a passphrases.  If encryption is successful, it
+returns @code{t}, otherwise @code{nil}.  This function is currently only
+implemented for GnuPG.
 @end deffn
 
 @deffn Method pgg-scheme-decrypt-region scheme start end
Index: man/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/man/ChangeLog,v
retrieving revision 1.683
diff -u -r1.683 ChangeLog
--- man/ChangeLog	8 Oct 2005 02:55:16 -0000	1.683
+++ man/ChangeLog	8 Oct 2005 10:31:12 -0000
@@ -10,6 +10,14 @@
 	* building.texi (GDB Graphical Interface): Add variables and
 	functions to indices.  Be more precise.
 
+2005-10-06  Sascha Wilde  <swilde@sha-bang.de>
+
+	* pgg.texi (How to use): Added autoload line for
+	`pgg-encrypt-symmetric-region'.
+	(User Commands): Description of `pgg-encrypt-symmetric-region'.
+	(Backend methods): Describe new funktion
+	`pgg-scheme-encrypt-symmetric-region'.
+
 2005-10-05  Nick Roberts  <nickrob@snap.net.nz>
 
 	* speedbar.texi (GDB): Describe use of watch expressions.
Index: lisp/gnus/pgg.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/gnus/pgg.el,v
retrieving revision 1.8
diff -u -r1.8 pgg.el
--- lisp/gnus/pgg.el	26 Aug 2005 00:02:05 -0000	1.8
+++ lisp/gnus/pgg.el	8 Oct 2005 10:31:13 -0000
@@ -4,6 +4,7 @@
 ;;   2005 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
+;; Symmetric encryption added by: Sascha Wilde <wilde@sha-bang.de>
 ;; Created: 1999/10/28
 ;; Keywords: PGP
 
@@ -232,6 +233,32 @@
 	 (pgg-save-coding-system start end
 	   (pgg-invoke "encrypt-region" (or pgg-scheme pgg-default-scheme)
 		       (point-min) (point-max) rcpts sign))))
+    (when (interactive-p)
+      (pgg-display-output-buffer start end status))
+    status))
+
+;;;###autoload
+(defun pgg-encrypt-symmetric-region (start end)
+  "Encrypt the current region between START and END symmetric with passphrase."
+  (interactive "r")
+  (let ((status
+	 (pgg-save-coding-system start end
+	   (pgg-invoke "encrypt-symmetric-region" 
+		       (or pgg-scheme pgg-default-scheme)
+		       (point-min) (point-max)))))
+    (when (interactive-p)
+      (pgg-display-output-buffer start end status))
+    status))
+
+;;;###autoload
+(defun pgg-encrypt-symmetric (&optional start end)
+  "Encrypt the current buffer symmetric with passphrase.
+If optional arguments START and END are specified, only encrypt within
+the region."
+  (interactive)
+  (let* ((start (or start (point-min)))
+	 (end (or end (point-max)))
+	 (status (pgg-encrypt-symmetric-region start end)))
     (when (interactive-p)
       (pgg-display-output-buffer start end status))
     status))
Index: lisp/gnus/pgg-gpg.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/gnus/pgg-gpg.el,v
retrieving revision 1.7
diff -u -r1.7 pgg-gpg.el
--- lisp/gnus/pgg-gpg.el	8 Oct 2005 08:43:33 -0000	1.7
+++ lisp/gnus/pgg-gpg.el	8 Oct 2005 10:31:14 -0000
@@ -4,6 +4,7 @@
 ;;   2005 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
+;; Symmetric encryption added by: Sascha Wilde <wilde@sha-bang.de>
 ;; Created: 1999/10/28
 ;; Keywords: PGP, OpenPGP, GnuPG
 
@@ -150,7 +151,7 @@
 	     pgg-gpg-user-id)))
 	 (args
 	  (append
-	   (list "--batch" "--armor" "--always-trust" "--encrypt")
+	   (list "--batch" "--textmode" "--armor" "--always-trust" "--encrypt")
 	   (if sign (list "--sign" "--local-user" pgg-gpg-user-id))
 	   (if recipients
 	       (apply #'nconc
@@ -169,6 +170,16 @@
 	(pgg-gpg-possibly-cache-passphrase passphrase)))
     (pgg-process-when-success)))
 
+(defun pgg-gpg-encrypt-symmetric-region (start end)
+  "Encrypt the current region between START and END with symmetric cipher."
+  (let* ((passphrase
+	  (pgg-read-passphrase "GnuPG passphrase for symmetric encryption: "))
+	 (args
+	  (append (list "--batch" "--textmode" "--armor" "--symmetric" ))))
+    (pgg-as-lbt start end 'CRLF
+      (pgg-gpg-process-region start end passphrase pgg-gpg-program args))    
+    (pgg-process-when-success)))
+
 (defun pgg-gpg-decrypt-region (start end)
   "Decrypt the current region between START and END."
   (let* ((current-buffer (current-buffer))
@@ -180,7 +191,10 @@
 	 (pgg-gpg-user-id (or key pgg-gpg-user-id pgg-default-user-id))
 	 (passphrase
 	  (pgg-read-passphrase
-	   (format "GnuPG passphrase for %s: " pgg-gpg-user-id)
+	   (format (if (pgg-gpg-symmetric-key-p message-keys)
+		       "Passphrase for symmetric dencryption: "
+		       "GnuPG passphrase for %s: ")
+		   pgg-gpg-user-id)
 	   pgg-gpg-user-id))
 	 (args '("--batch" "--decrypt")))
     (pgg-gpg-process-region start end passphrase pgg-gpg-program args)
@@ -188,6 +202,14 @@
       (pgg-gpg-possibly-cache-passphrase passphrase pgg-gpg-user-id)
       (goto-char (point-min))
       (re-search-forward "^\\[GNUPG:] DECRYPTION_OKAY\\>" nil t))))
+
+(defun pgg-gpg-symmetric-key-p (message-keys)
+  "Check if MESSAGE-KEYS contains a symmetric encryption indicator."
+  (let ((result))
+    (dolist (key message-keys result)
+      (when (and (eq (car key) 3)
+		 (member '(symmetric-key-algorithm) key))
+	(setq result key)))))
 
 (defun pgg-gpg-select-matching-key (message-keys secret-keys)
   "Choose a key from MESSAGE-KEYS that matches one of the keys in SECRET-KEYS."
Index: lisp/gnus/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/gnus/ChangeLog,v
retrieving revision 1.392
diff -u -r1.392 ChangeLog
--- lisp/gnus/ChangeLog	8 Oct 2005 08:45:31 -0000	1.392
+++ lisp/gnus/ChangeLog	8 Oct 2005 10:31:16 -0000
@@ -1,3 +1,15 @@
+2005-10-06  Sascha Wilde  <swilde@sha-bang.de>
+
+	* pgg-gpg.el (pgg-gpg-encrypt-symmetric-region): New function for
+	symmetric encryption.
+	(pgg-gpg-symmetric-key-p): New function to check for an symmetric
+	encrypted session key.
+	(pgg-gpg-decrypt-region): When decrypting a symmetric encrypted
+	message ask for the passphrase in a proper way.
+
+	* pgg.el (pgg-encrypt-symmetric,pgg-encrypt-symmetric-region):
+	New user commands for symmetric encryption.
+
 2005-01-21  Derek Atkins <warlord@MIT.EDU>  (tiny change)
 
 	* pgg-pgp.el (pgg-pgp-decrypt-region): Use passphrase cache.

[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2005-10-08 10:36 UTC|newest]

Thread overview: 156+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-30 17:24 new version of allout.el - patch and ChangeLog Ken Manheimer
2005-09-30 21:06 ` Sascha Wilde
2005-09-30 21:52   ` Ken Manheimer
2005-10-01  8:20     ` Andreas Schwab
2005-10-01 12:41       ` Reiner Steib
2005-10-01 23:54         ` James Cloos
2005-10-01 16:28     ` Ken Manheimer
2005-10-02 10:48       ` Sascha Wilde
2005-10-02 14:23         ` Ken Manheimer
2005-10-02 20:31         ` Richard M. Stallman
2005-10-03 19:25           ` pgg symmetric encryption patch (was: new version of allout.el - patch and ChangeLog) Sascha Wilde
2005-10-03 19:50             ` Ken Manheimer
2005-10-04 10:53               ` Sascha Wilde
2005-10-04 12:46                 ` pgg symmetric encryption patch Stefan Monnier
2005-10-05 16:19                 ` Sascha Wilde
2005-10-05 19:16                   ` Ken Manheimer
2005-10-10  4:15                     ` Richard M. Stallman
2005-10-06  2:18                   ` Daiki Ueno
2005-10-06  9:01                     ` Sascha Wilde
2005-10-06 22:41                       ` Ken Manheimer
2005-10-07 10:00                         ` Sascha Wilde
2005-10-07 18:06                           ` Ken Manheimer
2005-10-07 21:49                             ` Sascha Wilde
2005-10-08  8:48                               ` Simon Josefsson
2005-10-08 10:36                                 ` Sascha Wilde [this message]
2005-10-08 11:14                                   ` Simon Josefsson
2005-10-08 12:56                                     ` Ken Manheimer
2005-10-08 22:56                                       ` Richard M. Stallman
2005-10-10 21:50                                         ` Ken Manheimer
2005-10-11 14:44                                           ` Richard M. Stallman
2005-10-08 13:43                                     ` Sascha Wilde
2005-10-08 18:31                                   ` Ken Manheimer
2005-10-08 19:16                                     ` Ken Manheimer
2005-10-10 21:15                                     ` Ken Manheimer
2005-10-10 21:16                                       ` Ken Manheimer
2005-10-12 23:47                                       ` Ken Manheimer
2005-10-20 14:08                                         ` Ken Manheimer
2005-10-20 14:12                                           ` Simon Josefsson
2005-10-20 14:30                                             ` Ken Manheimer
2005-10-20 14:42                                             ` Sascha Wilde
2005-10-25  7:23                                               ` Sascha Wilde
2005-10-25 20:26                                                 ` Ken Manheimer
2005-10-25 21:18                                                   ` Sascha Wilde
2005-10-25 21:28                                                     ` Ken Manheimer
2005-10-26  9:57                                                       ` Sascha Wilde
2005-10-26 15:45                                                         ` Ken Manheimer
2005-10-27  7:37                                                           ` Sascha Wilde
2005-10-29 11:42                                                             ` Eli Zaretskii
2005-10-29 19:50                                                               ` Ken Manheimer
2005-10-31 17:30                                                                 ` Ken Manheimer
2005-11-04 14:45                                                                   ` Eli Zaretskii
2005-10-20 18:07                                             ` Relocating pgg*.el (was: pgg symmetric encryption patch) Reiner Steib
2005-10-20 22:22                                               ` Kim F. Storm
2005-10-21  4:49                                                 ` Richard M. Stallman
2005-10-20 23:38                                             ` pgg symmetric encryption patch Richard M. Stallman
2005-10-21  7:07                                               ` Simon Josefsson
2006-03-18 21:17                                             ` Small patch to enable use of gpg-agent with pgg Sascha Wilde
2006-03-18 23:30                                               ` Daniel Pittman
2006-03-19  0:46                                                 ` Miles Bader
2006-03-19  3:45                                                   ` Daniel Pittman
2006-03-19 18:28                                                     ` Miles Bader
2006-03-19  9:49                                                 ` Sascha Wilde
2006-03-19 17:30                                                   ` Sascha Wilde
2006-03-21 14:32                                               ` Simon Josefsson
2006-03-21 21:29                                                 ` Reiner Steib
2006-03-22  9:49                                                   ` Simon Josefsson
2006-03-22  8:36                                                 ` Sascha Wilde
2006-03-22  9:16                                                   ` Daiki Ueno
2006-03-22  9:48                                                     ` Simon Josefsson
2006-03-22 11:03                                                     ` Sascha Wilde
2006-03-22 11:13                                                       ` Simon Josefsson
2006-03-22 12:25                                                         ` Daiki Ueno
2006-03-23 10:40                                                           ` Daiki Ueno
2006-03-23 11:00                                                             ` Simon Josefsson
2006-03-23 12:18                                                               ` Daiki Ueno
2006-03-23 13:08                                                                 ` Simon Josefsson
2006-03-24  5:51                                                                   ` Daiki Ueno
2006-03-26  0:29                                                                     ` Daiki Ueno
2006-03-26  1:08                                                                       ` Simon Josefsson
2006-03-26  3:29                                                                         ` Miles Bader
2006-03-26  5:06                                                                           ` Daiki Ueno
2006-03-26 17:05                                                                             ` Simon Josefsson
2006-03-26 18:24                                                                               ` Sascha Wilde
2006-03-27  9:36                                                                                 ` Simon Josefsson
2006-03-23 12:52                                                             ` Sascha Wilde
2006-03-23 20:07                                                               ` Daiki Ueno
2006-03-23 22:16                                                                 ` Sascha Wilde
2006-04-05  9:13                                                                   ` pgg-gpg broken? Sascha Wilde
2006-04-05  9:42                                                                     ` Daiki Ueno
2006-04-05 10:18                                                                       ` Sascha Wilde
2006-04-05 21:33                                                                         ` Daiki Ueno
2006-04-06  9:00                                                                           ` Sascha Wilde
2006-04-06  9:21                                                                             ` Daiki Ueno
2006-04-06  9:58                                                                               ` Sascha Wilde
2006-04-06 10:13                                                                                 ` Daiki Ueno
2006-04-07 10:32                                                                                 ` gpg-agent support removed?! (was: pgg-gpg broken?) Sascha Wilde
2006-04-07 12:11                                                                                   ` Simon Josefsson
2006-04-07 12:14                                                                                   ` gpg-agent support removed?! Romain Francoise
2006-04-07 13:00                                                                                     ` Sascha Wilde
2006-04-07 13:30                                                                                       ` Simon Josefsson
2006-04-07 20:59                                                                                         ` Reiner Steib
2006-04-08  9:36                                                                                       ` Romain Francoise
2006-04-08 10:05                                                                                         ` Sascha Wilde
2006-04-07 12:35                                                                                   ` Reiner Steib
2006-04-07 13:02                                                                                     ` Daiki Ueno
2006-04-07 13:08                                                                                       ` Sascha Wilde
2006-04-07 13:26                                                                                         ` Daiki Ueno
2006-04-09 16:04                                                                                           ` Sascha Wilde
2006-04-10 18:04                                                                                             ` Reiner Steib
2006-04-07 13:40                                                                                         ` Reiner Steib
2006-04-07 14:05                                                                                       ` Thomas Baumann
2006-04-07 14:40                                                                                         ` Daiki Ueno
2006-04-07 15:45                                                                                           ` Reiner Steib
2006-04-07 20:55                                                                                             ` Daiki Ueno
2006-04-07 21:22                                                                                               ` Reiner Steib
2006-04-08  7:03                                                                                                 ` Thomas Baumann
2006-04-08 10:18                                                                                                 ` Daiki Ueno
2006-04-07 21:36                                                                                     ` Richard Stallman
2006-04-08  9:45                                                                                       ` Romain Francoise
2006-04-08 10:11                                                                                         ` Daiki Ueno
2006-04-08 11:30                                                                                           ` Romain Francoise
2006-04-08 11:58                                                                                             ` Daiki Ueno
2006-04-10 18:04                                                                                               ` PGG maintainance (was: gpg-agent support removed?!) Reiner Steib
2006-04-10 22:40                                                                                           ` gpg-agent support removed?! Ken Manheimer
2006-04-08 22:34                                                                                         ` Richard Stallman
2006-04-05 16:14                                                                     ` pgg-gpg broken? Reiner Steib
2006-04-05 19:22                                                                       ` Sascha Wilde
2006-03-22  9:46                                                   ` Small patch to enable use of gpg-agent with pgg Simon Josefsson
2006-03-22 16:13                                                   ` Simon Josefsson
2006-03-22 23:01                                                     ` Katsumi Yamaoka
2006-03-22 23:45                                                       ` Simon Josefsson
2006-03-23  0:58                                                         ` Katsumi Yamaoka
2006-03-23  9:12                                                           ` Simon Josefsson
2006-03-23 10:26                                                             ` Sascha Wilde
2006-03-23 10:54                                                               ` Simon Josefsson
2006-03-23 11:12                                                                 ` Simon Josefsson
2006-03-23 11:16                                                                   ` Simon Josefsson
2006-03-23 12:51                                                                     ` Reiner Steib
2006-03-23 13:07                                                                       ` Sascha Wilde
2006-03-23 13:10                                                                         ` Simon Josefsson
2006-03-23 12:00                                                                   ` Sascha Wilde
2006-03-23 13:00                                                                     ` Simon Josefsson
2006-03-26 18:11                                                                       ` Sascha Wilde
     [not found]                                                                   ` <m2wtels74l.fsf@kenny.sha-bang .de>
2006-03-23 23:09                                                                     ` Miles Bader
2006-04-02  0:30                                                                       ` Ken Manheimer
2006-04-02  8:28                                                                         ` Daiki Ueno
2005-12-09 15:43                         ` pgg symmetric encryption patch Simon Josefsson
2005-12-09 20:30                           ` Stefan Monnier
2005-12-09 20:31                           ` Stefan Monnier
2005-12-10  4:13                           ` Richard M. Stallman
2005-12-10 10:50                             ` Simon Josefsson
2005-12-11 13:32                               ` Sascha Wilde
2005-12-11 13:42                                 ` Simon Josefsson
2005-10-02 17:08       ` new version of allout.el - patch and ChangeLog Richard M. Stallman
     [not found] ` <E1ELj0L-0000Pn-3T@fencepost.gnu.org>
2005-10-01 22:33   ` Ken Manheimer
2005-10-20 13:57     ` Ken Manheimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051008103627.GA1218@kenny.sha-bang.local \
    --to=wilde@sha-bang.de \
    --cc=emacs-devel@gnu.org \
    --cc=ken.manheimer@gmail.com \
    --cc=rms@gnu.org \
    --cc=schwab@suse.de \
    --cc=ueno@unixuser.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).