[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EasyPG API and usage questions (was: Suggestion: epa-file-select-key

From: Daiki Ueno
Subject: Re: EasyPG API and usage questions (was: Suggestion: epa-file-select-keys should show currently selected keys)
Date: Sat, 1 Mar 2008 09:23:02 +0900

2008/3/1, Ted Zlatanov <address@hidden>:
>  I want to replace encrypt.el with EasyPG in netrc.el (in Gnus and later
>  also in Emacs).  Can you explain how to replace this
>  (let ((encryption-model
>        (when (netrc-bound-and-true-p encrypt-file-alist)
>          (encrypt-find-model file))))
>   (if encryption-model
>       (encrypt-insert-file-contents file encryption-model)
>     (insert-file-contents file)))
>  with the equivalent EasyPG string-based or buffer-based functions?
>  It seems like (insert (epg-decrypt-string ...)) or
>  epa-file-insert-file-contents is the way to do it (probably the second
>  one), but I'd like to be sure I'm following the recommended usage.
>  Should netrc.el use the epa-* or epg-* interface?

Doesn't it work without any change?  epa-file changes
insert-file-contents behavior to decrypt *.gpg files automatically.

For example, I believe that the following code just works:

(epa-file-enable);; this may become (auto-encryption-mode t) in the future.

(setq nnimap-authinfo-file "~/.authinfo.gpg"
      nntp-authinfo-file "~/.authinfo.gpg"
      smtpmail-auth-credentials "~/.authinfo.gpg")

What feature do you want in addition to this?

>  functionality?  The epa.texi file doesn't seem to cover
>  epa-file-name-regexp for example, to explain what will happen with files
>  that match, and how to create such files with various options (see
>  below).  By the way, epa-file-name-regexp should be a list of regular
>  expressions and filenames, so the users can add something easily to the
>  list.

If all the custom-options should be documented in texi, I will do it.

>  Generally the EasyPG user documentation is very bare, so I had a hard
>  time understanding how to use it.  Is there additional documentation
>  outside of epa.texi?  Specifically, as a user I couldn't figure out how
>  to do the following from inside EasyPG:

Which are you talking about: user commands or API?

As the web-page says, EasyPG is consists of two different kinds of
components: EasyPG Assistant and EasyPG Library.  EasyPG Assistant is
an analog to GPA and EasyPG Library is an analog to GPGME.

Since IIRC Richard doesn't want API docs in texi, I only provide the
docs of EasyPG Assistant (user commands) and I think that epa.texi is
sufficient for typical users.

Anyway, a good starting point to use the EasyPG Library is the GPGME manual.

>  - how do I specify a particular cipher?

There is no such API in lisp level, since I doubt that there is any
practical use to select ciphers per data.  Is it not enough to put
cipher-algo option in ~/.gnupg/gpg.conf?

>  - how do I specify symmetric encryption?

Just pass nil as RECIPIENTS to the epg-encrypt-*.  This is documented
in their docstrings.

>  - how do I specify plaintext instead of binary output?

s/plaintext/ASCII armor/?  It can be done with:

(let ((epg-make-context 'OpenPGP))
  (epg-context-set-armor t)
  (epg-encrypt-string context "test test test" nil))

>  - how do I generate a GPG key?  (I realize GPG will do it, but epa.texi
>   just says you can import keys without explaining)

There are API functions epg-generate-key-from-*, but interactive
commands are missing.  Patches welcome.

Daiki Ueno

reply via email to

[Prev in Thread] Current Thread [Next in Thread]