From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Manheimer Newsgroups: gmane.emacs.devel Subject: Re: pgg symmetric encryption patch Date: Sat, 29 Oct 2005 15:50:02 -0400 Message-ID: <2cd46e7f0510291250p7ae24a18m3ef2d1af43c34b2c@mail.gmail.com> References: <20051007100014.GB4850@kenny.sha-bang.local> <20051020144236.GA6418@kenny.sha-bang.local> <2cd46e7f0510251326w61ad1899wcf8286d04387e962@mail.gmail.com> <2cd46e7f0510251428l7b143956m5d7635e4b38898b0@mail.gmail.com> <2cd46e7f0510260845r7421efc1kfcd33b24c1a27569@mail.gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_13099_15284690.1130615402869" X-Trace: sea.gmane.org 1130615465 25917 80.91.229.2 (29 Oct 2005 19:51:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 29 Oct 2005 19:51:05 +0000 (UTC) Cc: rms@gnu.org, Sascha Wilde , schwab@suse.de, ueno@unixuser.org, emacs-devel@gnu.org, jas@extundo.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 29 21:51:01 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EVwic-0004M9-Fz for ged-emacs-devel@m.gmane.org; Sat, 29 Oct 2005 21:50:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EVwiZ-0003Vd-BL for ged-emacs-devel@m.gmane.org; Sat, 29 Oct 2005 15:50:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EVwiN-0003VV-G5 for emacs-devel@gnu.org; Sat, 29 Oct 2005 15:50:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EVwiM-0003VI-FU for emacs-devel@gnu.org; Sat, 29 Oct 2005 15:50:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EVwiL-0003VB-EH for emacs-devel@gnu.org; Sat, 29 Oct 2005 15:50:05 -0400 Original-Received: from [64.233.162.204] (helo=zproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EVwiK-0003dx-Vw for emacs-devel@gnu.org; Sat, 29 Oct 2005 15:50:05 -0400 Original-Received: by zproxy.gmail.com with SMTP id k1so282332nzf for ; Sat, 29 Oct 2005 12:50:03 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=KAHy55rna3I36/KnuH8g4fOD2Pe+LxjfMHXyniA9hAal4IgpvO+lCaJgY2Aoj0IoEAf7FIjohfzRxmLl8JVO15No9CFpUbQo70KMiJ5e0Lok2b81i1BynzWTVt0VafIgw2tofYPBUIdVILlnS+ESal95U5/7dr0V0dyaimO4iRI= Original-Received: by 10.36.96.19 with SMTP id t19mr1780309nzb; Sat, 29 Oct 2005 12:50:02 -0700 (PDT) Original-Received: by 10.36.39.19 with HTTP; Sat, 29 Oct 2005 12:50:02 -0700 (PDT) Original-To: Eli Zaretskii In-Reply-To: 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:45096 Archived-At: ------=_Part_13099_15284690.1130615402869 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline thanks for applying the patches. it looks all in place. i have a supplemental patch which reenables pgp and pgp5 operation, as well as rectifying the pgg.texi documentation with the changes (plus suitable entries for lisp/ChangeLog and man/ChangeLog). this patch is somewhat speculative because i am unable to test it, not having pgp or pgp5. most of the additional functionality is not specific to the encryption software implementation, and where it is (providing the right arguments for signing) i used a man page found on the web to try to do the right thing. one thing i know is that pgg-pgp5 and pgg-pgp would *not* work without this patch, because there would be calling mismatches from the pgg generic functions. i am fairly confident that the patched code will work well. ken ken.manheimer@gmail.com On 10/29/05, Eli Zaretskii wrote: > > From: Sascha Wilde > > Date: Thu, 27 Oct 2005 09:37:58 +0200 > > Cc: Simon Josefsson , sascha schwab , > > "Daiki Ueno \(pgg author\)" , > > "Richard M. Stallman" , emacs-devel@gnu.org > > > > Ken Manheimer wrote: > > > > > On 10/26/05, Sascha Wilde wrote: > > >> Thanks for the patch, but I'm missing the additions to the pgg > > >> documentation I made. > > > > > > here is the texi part of your patch, exactly as it was in > > > emacs-pgg-symmetric.patch-5 as you sent it. (i included your > > > ChangeLog entry in the part of my patch for the ChangeLog, and > > > similarly for the pgg.el and pgg-gpg.el source files, so i think it's > > > now complete.) > > > > Yes, thank you! > > > > Could someone with write access please commit these two patches? > > Done, thanks. > ------=_Part_13099_15284690.1130615402869 Content-Type: application/octet-stream; name=pgg-pgp-compat.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pgg-pgp-compat.patch" Index: lisp/ChangeLog =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.8476 diff -u -r1.8476 ChangeLog --- lisp/ChangeLog 29 Oct 2005 16:02:05 -0000 1.8476 +++ lisp/ChangeLog 29 Oct 2005 19:32:47 -0000 @@ -1,3 +1,23 @@ +2005-10-29 Ken Manheimer + + * pgg-pgp.el (pgg-pgp-encrypt-region, pgg-pgp-decrypt-region) + (pgg-pgp-encrypt-symmetric-region, pgg-pgp-encrypt-symmetric) + (pgg-pgp-encrypt, pgg-pgp-decrypt-region, pgg-pgp-decrypt) + (pgg-pgp-sign-region, pgg-pgp-sign): Add optional 'passphrase' + argument to all these routines, so the passphrase can be managed + externally and passed in to the system. + (pgg-pgp-decrypt-region, pgg-pgp-sign-region): Use new name for + pgg-add-passphrase-to-cache function. + + * pgg-pgp5.el (pgg-pgp5-encrypt-region, pgg-pgp5-decrypt-region) + (pgg-pgp5-encrypt-symmetric-region, pgg-pgp5-encrypt-symmetric) + (pgg-pgp5-encrypt, pgg-pgp5-decrypt-region, pgg-pgp5-decrypt) + (pgg-pgp5-sign-region, pgg-pgp5-sign): Add optional 'passphrase' + argument to all these routines, so the passphrase can be managed + externally and passed in to the system. + (pgg-pgp5-sign-region): Use new name of + pgg-add-passphrase-to-cache function. + 2005-10-29 Roland Winkler * textmodes/conf-mode.el (conf-assignment-sign) @@ -63,10 +83,10 @@ so the passphrase cache can be used reliably with identifiers besides a pgp packet's key id. - * pgg-gpg.el (pgg-pgp-encrypt-region) - (pgg-pgp-encrypt-symmetric-region, pgg-pgp-encrypt-symmetric) - (pgg-pgp-encrypt, pgg-pgp-decrypt-region, pgg-pgp-decrypt) - (pgg-pgp-sign-region, pgg-pgp-sign): Add optional 'passphrase' + * pgg-gpg.el (pgg-gpg-encrypt-region) + (pgg-gpg-encrypt-symmetric-region, pgg-gpg-encrypt-symmetric) + (pgg-gpg-encrypt, pgg-gpg-decrypt-region, pgg-gpg-decrypt) + (pgg-gpg-sign-region, pgg-gpg-sign): Add optional 'passphrase' argument to all these routines, so the passphrase can be managed externally and passed in to the system. Index: lisp/pgg-pgp.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/pgg-pgp.el,v retrieving revision 1.1 diff -u -r1.1 pgg-pgp.el --- lisp/pgg-pgp.el 24 Oct 2005 09:46:27 -0000 1.1 +++ lisp/pgg-pgp.el 29 Oct 2005 19:32:48 -0000 @@ -132,41 +132,57 @@ (buffer-substring (point)(progn (end-of-line) (point))))) 2)))))) -(defun pgg-pgp-encrypt-region (start end recipients) +(defun pgg-pgp-encrypt-region (start end recipients &optional sign passphrase) "Encrypt the current region between START and END." (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) + (passphrase (or passphrase + (when sign + (pgg-read-passphrase + (format "PGP passphrase for %s: " + pgg-pgp-user-id) + pgg-gpg-user-id)))) (args - `("+encrypttoself=off +verbose=1" "+batchmode" - "+language=us" "-fate" - ,@(if recipients - (mapcar (lambda (rcpt) (concat "\"" rcpt "\"")) - (append recipients - (if pgg-encrypt-for-me - (list pgg-pgp-user-id)))))))) + (append + `("+encrypttoself=off +verbose=1" "+batchmode" + "+language=us" "-fate" + ,@(if recipients + (mapcar (lambda (rcpt) (concat "\"" rcpt "\"")) + (append recipients + (if pgg-encrypt-for-me + (list pgg-pgp-user-id)))))) + (if sign '("-s" "-u" pgg-pgp-user-id))))) (pgg-pgp-process-region start end nil pgg-pgp-program args) (pgg-process-when-success nil))) -(defun pgg-pgp-decrypt-region (start end) - "Decrypt the current region between START and END." +(defun pgg-pgp-decrypt-region (start end &optional passphrase) + "Decrypt the current region between START and END. + +If optional PASSPHRASE is not specified, it will be obtained from the +passphrase cache or user." (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) (key (pgg-pgp-lookup-key pgg-pgp-user-id 'encrypt)) (passphrase - (pgg-read-passphrase - (format "PGP passphrase for %s: " pgg-pgp-user-id) key)) + (or passphrase + (pgg-read-passphrase + (format "PGP passphrase for %s: " pgg-pgp-user-id) key))) (args - '("+verbose=1" "+batchmode" "+language=us" "-f"))) + '("+verbose=1" "+batchmode" "+language=us" "-f"))) (pgg-pgp-process-region start end passphrase pgg-pgp-program args) (pgg-process-when-success (if pgg-cache-passphrase - (pgg-add-passphrase-cache key passphrase))))) + (pgg-add-passphrase-to-cache key passphrase))))) + +(defun pgg-pgp-sign-region (start end &optional clearsign passphrase) + "Make detached signature from text between START and END. -(defun pgg-pgp-sign-region (start end &optional clearsign) - "Make detached signature from text between START and END." +If optional PASSPHRASE is not specified, it will be obtained from the +passphrase cache or user." (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) (passphrase - (pgg-read-passphrase - (format "PGP passphrase for %s: " pgg-pgp-user-id) - (pgg-pgp-lookup-key pgg-pgp-user-id 'sign))) + (or passphrase + (pgg-read-passphrase + (format "PGP passphrase for %s: " pgg-pgp-user-id) + (pgg-pgp-lookup-key pgg-pgp-user-id 'sign)))) (args (list (if clearsign "-fast" "-fbast") "+verbose=1" "+language=us" "+batchmode" @@ -181,7 +197,7 @@ (point)) (point-max)))))) (if pgg-cache-passphrase - (pgg-add-passphrase-cache + (pgg-add-passphrase-to-cache (cdr (assq 'key-identifier packet)) passphrase))))))) Index: lisp/pgg-pgp5.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/pgg-pgp5.el,v retrieving revision 1.1 diff -u -r1.1 pgg-pgp5.el --- lisp/pgg-pgp5.el 24 Oct 2005 09:46:27 -0000 1.1 +++ lisp/pgg-pgp5.el 29 Oct 2005 19:32:48 -0000 @@ -143,41 +143,51 @@ (buffer-substring (match-end 0)(progn (end-of-line)(point))))) 2))))) -(defun pgg-pgp5-encrypt-region (start end recipients &optional sign) +(defun pgg-pgp5-encrypt-region (start end recipients &optional sign passphrase) "Encrypt the current region between START and END." (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) + (passphrase (or passphrase + (when sign + (pgg-read-passphrase + (format "PGP passphrase for %s: " + pgg-pgp5-user-id) + pgg-pgp5-user-id)))) (args - `("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1" - ,@(if recipients - (apply #'append - (mapcar (lambda (rcpt) - (list "-r" - (concat "\"" rcpt "\""))) - (append recipients - (if pgg-encrypt-for-me - (list pgg-pgp5-user-id))))))))) + (append + `("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1" + ,@(if recipients + (apply #'append + (mapcar (lambda (rcpt) + (list "-r" + (concat "\"" rcpt "\""))) + (append recipients + (if pgg-encrypt-for-me + (list pgg-pgp5-user-id))))))) + (if sign '("-s" "-u" pgg-pgp5-user-id))))) (pgg-pgp5-process-region start end nil pgg-pgp5-pgpe-program args) (pgg-process-when-success nil))) -(defun pgg-pgp5-decrypt-region (start end) +(defun pgg-pgp5-decrypt-region (start end &optional passphrase) "Decrypt the current region between START and END." (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) (passphrase - (pgg-read-passphrase - (format "PGP passphrase for %s: " pgg-pgp5-user-id) - (pgg-pgp5-lookup-key pgg-pgp5-user-id 'encrypt))) + (or passphrase + (pgg-read-passphrase + (format "PGP passphrase for %s: " pgg-pgp5-user-id) + (pgg-pgp5-lookup-key pgg-pgp5-user-id 'encrypt)))) (args '("+verbose=1" "+batchmode=1" "+language=us" "-f"))) (pgg-pgp5-process-region start end passphrase pgg-pgp5-pgpv-program args) (pgg-process-when-success nil))) -(defun pgg-pgp5-sign-region (start end &optional clearsign) +(defun pgg-pgp5-sign-region (start end &optional clearsign passphrase) "Make detached signature from text between START and END." (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) (passphrase - (pgg-read-passphrase - (format "PGP passphrase for %s: " pgg-pgp5-user-id) - (pgg-pgp5-lookup-key pgg-pgp5-user-id 'sign))) + (or passphrase + (pgg-read-passphrase + (format "PGP passphrase for %s: " pgg-pgp5-user-id) + (pgg-pgp5-lookup-key pgg-pgp5-user-id 'sign)))) (args (list (if clearsign "-fat" "-fbat") "+verbose=1" "+language=us" "+batchmode=1" @@ -191,7 +201,7 @@ (point)) (point-max)))))) (if pgg-cache-passphrase - (pgg-add-passphrase-cache + (pgg-add-passphrase-to-cache (cdr (assq 'key-identifier packet)) passphrase))))))) Index: man/ChangeLog =================================================================== RCS file: /cvsroot/emacs/emacs/man/ChangeLog,v retrieving revision 1.715 diff -u -r1.715 ChangeLog --- man/ChangeLog 29 Oct 2005 11:40:18 -0000 1.715 +++ man/ChangeLog 29 Oct 2005 19:32:51 -0000 @@ -1,3 +1,9 @@ +2005-10-29 Ken Manheimer + + * pgg.texi (User Commands): Document additional passphrase + argument for pgg-encrypt-*, pgg-decrypt-*, and pgg-sign-* functions. + (Backend methods): Likewise for corresponding pgg-scheme-* functions. + 2005-10-29 Sascha Wilde * pgg.texi (How to use): Update the example to add autoload of Index: man/pgg.texi =================================================================== RCS file: /cvsroot/emacs/emacs/man/pgg.texi,v retrieving revision 1.6 diff -u -r1.6 pgg.texi --- man/pgg.texi 29 Oct 2005 11:39:49 -0000 1.6 +++ man/pgg.texi 29 Oct 2005 19:32:51 -0000 @@ -129,7 +129,7 @@ fails immediately, but if the function had been called interactively, it would ask you to retrieve the signer's public key from the server. -@deffn Command pgg-encrypt-region start end recipients &optional sign +@deffn Command pgg-encrypt-region start end recipients &optional sign passphrase Encrypt the current region between @var{start} and @var{end} for @var{recipients}. When the function were called interactively, you would be asked about the recipients. @@ -138,29 +138,41 @@ the accessible portion) with the resulting data. If optional argument @var{sign} is non-@code{nil}, the function is -request to do a combined sign and encrypt. This currently only work -with GnuPG. +request to do a combined sign and encrypt. This currently is +confirmed to work with GnuPG, but might not work with PGP or PGP5. + +If optional @var{passphrase} is @code{nil}, the passphrase will be +obtained from the passphrase cache or user. @end deffn -@deffn Command pgg-encrypt-symmetric-region start end +@deffn Command pgg-encrypt-symmetric-region &optional start end passphrase 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. +If optional @var{passphrase} is @code{nil}, the passphrase will be +obtained from the passphrase cache or user. + +symmetric-cipher encryption is currently only implemented for GnuPG. @end deffn -@deffn Command pgg-decrypt-region start end +@deffn Command pgg-decrypt-region start end &optional passphrase Decrypt the current region between @var{start} and @var{end}. If decryption is successful, it replaces the current region contents (in the accessible portion) with the resulting data. + +If optional @var{passphrase} is @code{nil}, the passphrase will be +obtained from the passphrase cache or user. @end deffn -@deffn Command pgg-sign-region start end &optional cleartext +@deffn Command pgg-sign-region start end &optional cleartext passphrase Make the signature from text between @var{start} and @var{end}. If the optional third argument @var{cleartext} is non-@code{nil}, or the function is called interactively, it does not create a detached signature. In such a case, it replaces the current region contents (in the accessible portion) with the resulting data. + +If optional @var{passphrase} is @code{nil}, the passphrase will be +obtained from the passphrase cache or user. @end deffn @deffn Command pgg-verify-region start end &optional signature fetch @@ -309,26 +321,26 @@ keyrings. @end deffn -@deffn Method pgg-scheme-encrypt-region scheme start end recipients &optional sign +@deffn Method pgg-scheme-encrypt-region scheme start end recipients &optional sign passphrase Encrypt the current region between @var{start} and @var{end} for @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 +@deffn Method pgg-scheme-encrypt-symmetric-region scheme start end &optional passphrase 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 +@deffn Method pgg-scheme-decrypt-region scheme start end &optional passphrase Decrypt the current region between @var{start} and @var{end}. If decryption is successful, it returns @code{t}, otherwise @code{nil}. @end deffn -@deffn Method pgg-scheme-sign-region scheme start end &optional cleartext +@deffn Method pgg-scheme-sign-region scheme start end &optional cleartext passphrase Make the signature from text between @var{start} and @var{end}. If the optional third argument @var{cleartext} is non-@code{nil}, it does not create a detached signature. If signing is successful, it returns ------=_Part_13099_15284690.1130615402869 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 ------=_Part_13099_15284690.1130615402869--