[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dired-like interface for GPG
From: |
Daiki Ueno |
Subject: |
Re: dired-like interface for GPG |
Date: |
Tue, 18 Nov 2014 16:48:12 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Drew Adams <address@hidden> writes:
>> I would soon like to embark on making a GPG interface for Emacs. It
>> will be somewhat like dired, but you use it manage GPG keys in the
>> keyring.
>
> If you do, please keep things as close as makes sense to the way
> Dired does things (e.g. actions on marked things, conventional
> key bindings and menus). (But only where it makes sense.)
I like the idea, since `M-x epa-list-keys' is not very useful for key
management. For what it's worth I've just added a few functions to
epg.el, for advanced key editing. Now one can edit key attributes with:
--8<---------------cut here---------------start------------->8---
(defun disable-callback (context status string arg)
(cond
((and (equal status "GET_LINE")
(equal string "keyedit.prompt"))
(if (car arg)
(process-send-string (epg-context-process context) "quit\n")
(process-send-string (epg-context-process context) "disable\n")))
((equal status "GOT_IT")
(setcar arg t))
(t
(message "Unhandled status: %s %s" status string))))
;; Disable a key, associated with a string "test key".
(let ((context (epg-make-context 'OpenPGP))
(state (list nil))
keys)
(setq keys (epg-list-keys context "test key"))
(if keys
(epg-edit-key context (car keys) 'disable-callback state)))
--8<---------------cut here---------------end--------------->8---
The interface is a bit inconvenient, but consistent with the GPGME.
See more practical uses in GPA:
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpa.git;a=blob;f=src/gpgmeedit.c;h=7ff9a05c0c5e8fbd1599313735160b8d8812f00b;hb=HEAD#l328
Regards,
--
Daiki Ueno