From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sascha Wilde Newsgroups: gmane.emacs.devel Subject: Re: pgg symmetric encryption patch Date: Sat, 8 Oct 2005 12:36:27 +0200 Message-ID: <20051008103627.GA1218@kenny.sha-bang.local> References: <2cd46e7f0510031250u66ea1349yb437d539ce4027ef@mail.gmail.com> <20051004105330.GA5288@kenny.sha-bang.local> <20051005161905.GA6208@kenny.sha-bang.local> <20051006090152.GB4494@kenny.sha-bang.local> <2cd46e7f0510061541w73bb6a92wb6d22829b6e804ae@mail.gmail.com> <20051007100014.GB4850@kenny.sha-bang.local> <2cd46e7f0510071106k3d4d3e6agc36f16a37d8b6bc6@mail.gmail.com> <20051007214952.GA30235@kenny.sha-bang.local> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2026288281==" X-Trace: sea.gmane.org 1128768364 9222 80.91.229.2 (8 Oct 2005 10:46:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 8 Oct 2005 10:46:04 +0000 (UTC) Cc: "sascha schwab \(symmetric encryption patches\)" , Ken Manheimer , "Daiki Ueno \(pgg author\)" , "Richard M. Stallman" , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 08 12:46:01 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EOCCO-0008LR-Oi for ged-emacs-devel@m.gmane.org; Sat, 08 Oct 2005 12:45:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EOC8O-0007vb-OQ for ged-emacs-devel@m.gmane.org; Sat, 08 Oct 2005 06:40:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EOC4J-0007FM-I1 for emacs-devel@gnu.org; Sat, 08 Oct 2005 06:36:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EOC4I-0007F3-M4 for emacs-devel@gnu.org; Sat, 08 Oct 2005 06:36:43 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EOC4H-0007Es-Kr for emacs-devel@gnu.org; Sat, 08 Oct 2005 06:36:41 -0400 Original-Received: from [62.141.58.119] (helo=km1136.keymachine.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EOC4G-0002sG-2X; Sat, 08 Oct 2005 06:36:40 -0400 Original-Received: from kenny.sha-bang.de (xdslp018.osnanet.de [82.149.190.18]) (authenticated bits=0) by km1136.keymachine.de (8.12.11/8.12.10) with ESMTP id j98AaQcc023191; Sat, 8 Oct 2005 12:36:28 +0200 Original-Received: from wilde by kenny.sha-bang.de with local (Kenny MUA v.0409034.42) ID 1EOC43-0001cO-Ch; Sat, 08 Oct 2005 12:36:27 +0200 Original-To: Simon Josefsson Mail-Followup-To: Simon Josefsson , Ken Manheimer , "sascha schwab (symmetric encryption patches)" , "Daiki Ueno (pgg author)" , "Richard M. Stallman" , emacs-devel@gnu.org In-Reply-To: User-Agent: Mutt/1.5.10i X-wieners-gbr-MailScanner-Information: MailScanner presented by www.wieners-gbr.de X-wieners-gbr-MailScanner: Nachricht wurde nicht auf Viren und Spam untersucht, sprechen Sie uns an: www.wieners-gbr.de. X-MailScanner-From: wilde@sha-bang.de X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:43683 Archived-At: --===============2026288281== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vGgW1X5XWziG23Ko" Content-Disposition: inline --vGgW1X5XWziG23Ko Content-Type: multipart/mixed; boundary="5mCyUwZo2JvN/JJP" Content-Disposition: inline --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 --=20 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 in comp.lang.lisp --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="emacs-pgg-symmetric.patch-04" Content-Transfer-Encoding: quoted-printable Index: man/pgg.texi =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =20 +@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 =20 @deffn Method pgg-scheme-decrypt-region scheme start end Index: man/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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. =20 +2005-10-06 Sascha Wilde + + * 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 =20 * speedbar.texi (GDB): Describe use of watch expressions. Index: lisp/gnus/pgg.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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. =20 ;; Author: Daiki Ueno +;; Symmetric encryption added by: Sascha Wilde ;; Created: 1999/10/28 ;; Keywords: PGP =20 @@ -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 passphr= ase." + (interactive "r") + (let ((status + (pgg-save-coding-system start end + (pgg-invoke "encrypt-symmetric-region"=20 + (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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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. =20 ;; Author: Daiki Ueno +;; Symmetric encryption added by: Sascha Wilde ;; Created: 1999/10/28 ;; Keywords: PGP, OpenPGP, GnuPG =20 @@ -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))) =20 +(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)) = =20 + (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))))) =20 (defun pgg-gpg-select-matching-key (message-keys secret-keys) "Choose a key from MESSAGE-KEYS that matches one of the keys in SECRET-K= EYS." Index: lisp/gnus/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 + + * 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 (tiny change) =20 * pgg-pgp.el (pgg-pgp-decrypt-region): Use passphrase cache. --5mCyUwZo2JvN/JJP-- --vGgW1X5XWziG23Ko Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFDR6ErchutvmkRUCQRAp/sAKCDDPSy0JS80aMZSUD4mP3is97/QQCfR/NY 3TIYzkeTK0++zBFUCrKlaMM= =VFK7 -----END PGP SIGNATURE----- --vGgW1X5XWziG23Ko-- --===============2026288281== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============2026288281==--