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: Mon, 31 Oct 2005 13:30:40 -0400 Message-ID: <2cd46e7f0510310930s13f7ed6bpbbef3e449e834053@mail.gmail.com> References: <20051007100014.GB4850@kenny.sha-bang.local> <2cd46e7f0510251326w61ad1899wcf8286d04387e962@mail.gmail.com> <2cd46e7f0510251428l7b143956m5d7635e4b38898b0@mail.gmail.com> <2cd46e7f0510260845r7421efc1kfcd33b24c1a27569@mail.gmail.com> <2cd46e7f0510291250p7ae24a18m3ef2d1af43c34b2c@mail.gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_27462_28225125.1130779840180" X-Trace: sea.gmane.org 1130780002 11475 80.91.229.2 (31 Oct 2005 17:33:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 31 Oct 2005 17:33:22 +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 Mon Oct 31 18:33:19 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EWdUq-0000hg-0U for ged-emacs-devel@m.gmane.org; Mon, 31 Oct 2005 18:31:01 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWdUn-0006ZY-SA for ged-emacs-devel@m.gmane.org; Mon, 31 Oct 2005 12:30:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EWdUa-0006ZK-Sa for emacs-devel@gnu.org; Mon, 31 Oct 2005 12:30:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EWdUY-0006YP-Le for emacs-devel@gnu.org; Mon, 31 Oct 2005 12:30:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWdUY-0006YJ-GC for emacs-devel@gnu.org; Mon, 31 Oct 2005 12:30:42 -0500 Original-Received: from [64.233.162.200] (helo=zproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EWdUY-0001LL-Ab for emacs-devel@gnu.org; Mon, 31 Oct 2005 12:30:42 -0500 Original-Received: by zproxy.gmail.com with SMTP id k1so505045nzf for ; Mon, 31 Oct 2005 09:30:40 -0800 (PST) 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=rW9QnWGAMOwiEcydY4p/uH00TEKyWTQNJQB9I85pagzPSO9CkUXmQQS9oWJn2eNJpogTVIE9Ag70/XBbWIkvxMciP57jotDh10M/nBY5ke6MjvbFO0XguTafHgN3UjhWQLgCl9heihBEMHhX52I61CU0qrXG/MCpnE601C5axok= Original-Received: by 10.36.224.34 with SMTP id w34mr3794784nzg; Mon, 31 Oct 2005 09:30:40 -0800 (PST) Original-Received: by 10.36.39.19 with HTTP; Mon, 31 Oct 2005 09:30:40 -0800 (PST) Original-To: Eli Zaretskii In-Reply-To: <2cd46e7f0510291250p7ae24a18m3ef2d1af43c34b2c@mail.gmail.com> 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:45186 Archived-At: ------=_Part_27462_28225125.1130779840180 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline as things approach release-readyness, i'm hoping that there's room to include this additional pgg patch i submitted. it brings the pgg-pgp and pgg-pgp5 support into line with the pgg scheme changes, and revises the pgg manual to track those changes as well. ken ken.manheimer@gmail.com On 10/29/05, Ken Manheimer wrote: > 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_27462_28225125.1130779840180 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_27462_28225125.1130779840180 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_27462_28225125.1130779840180--