Emacs interface to gpg

Patrik Jonsson patrik at ucolick.org
Tue Oct 18 11:15:03 CEST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

nega at exmachinae.net wrote:
> Patrik Jonsson writes:
> 
>  > I just started using gpg and was looking around for an emacs mode to
>  > encrypt/decrypt files during load and save.  There are a few vague
>  > references to crypt++, but they are all stale web sites and messages
>  > from years ago.  I finally managed to locate something that looked like
>  > the crypt++ web site, which had a notice that development on crypt++ had
>  > ceased and that instead crypt.el from xemacs should be used.  However, I
>  > downloaded the current version of xemacs and found no crypt.el.
>  > 
> 
> The latest version (via Google) is at
> http://freefriends.org/~karl/crypt++/crypt++.el 
> 
> Be sure and read the notes, as setup is slightly different if you're
> using Emacs or XEmacs.

Yeah, this is what I looked at. It doesn't seem to understand public-key
encryption using gpg. I've been trying to hack the gpg arguments to
allow public-key encoding. So far, I've got:

*** c:/Documents and Settings/Patrik/My Documents/crypt++.el	Tue Oct 18
02:11:38 2005
- --- c:/software/emacs-20.7/site-lisp/crypt++.el	Tue Oct 18 02:11:46 2005
***************
*** 955,962 ****
           crypt-encryption-magic-regexp
crypt-encryption-magic-regexp-inverse
           (or crypt-encryption-file-extension "\\(\\.gpg\\)$")
           "gpg" "gpg"
!          '("--batch" "--quiet" "-c" "-o" "-" "--passphrase-fd" "0")
!          '("--batch" "--quiet" "-o" "-" "--passphrase-fd" "0")
           "GPG"
           nil
           t
- --- 955,964 ----
           crypt-encryption-magic-regexp
crypt-encryption-magic-regexp-inverse
           (or crypt-encryption-file-extension "\\(\\.gpg\\)$")
           "gpg" "gpg"
!          '("--batch" "--quiet" "-a" "-e" "-o" "-" "-r" "d516e69f"
"--passphrase-fd" "0")
!          '("--batch" "--quiet" "-d" "--passphrase-fd" "0")
           "GPG"
           nil
           t

This almost works. I can find a new file test.gpg, write it and save. It
(unnecessarily) asks for a passphrase and produces an encrypted file.
I'm then able to find that file, give the passphrase and get a decrypted
file in the buffer.  However, if I try to save again I get the question
"save as a plain file?". The correct answer to this question appears to
be yes, this saves the file encrypted again.  However, if you think that
an encrypted file is not plain and answer no you'd get an error saying
"encoding failed!"  and from that point on further saves would fail.

There appears to be some hacking done to get the public-key stuff
working correctly with PGP and I haven't been able to figure it out.

Does anyone have any further insights?

Regards,

/Patrik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDVL0XT+KvsdUW5p8RAoKTAKCXs+EYgJExUJaxbTaCT23gqqQ4JgCgn48Y
1gdHJRMO2/Ium9os3zQqGEg=
=Gjpa
-----END PGP SIGNATURE-----



More information about the Gnupg-users mailing list