Extracting valid content; command line use of --edit-key

Werner Koch wk at gnupg.org
Tue Apr 2 10:31:01 CEST 2002


On Tue, 2 Apr 2002 00:20:43 +0200, Timo Schulz said:

> quite easy. First you should better use --status-fd=2 to get the
> hints what input GPG needs: 
> gpg --status-fd=2 --command-fd=0 --edit-key foo

> [GNUPG:] GET_LINE keyedit.prompt
> uid 2

Let me stress that you MUST act on the GET_* status lines and stop
processing if you encounter a line which you don't understand (you may
try to send just an empty line in such a case so a default can be
used).  The rationale is that --edit-key is an interactive menu driver
command which may change from version to version; for example the
current snapshot might issue some new prompts when signing a key.

By parsing the GET_* status lines and comparing the keywords you have
a robust interface.

> Alternative you can also store the input into a single file:

But this might fail after internal changes in GnuPG and does not
consider dynamic behaviour.  For example when signing a key, GnuPG ask
whether to sign all UIDs only if there is more than one UID.


  Werner





More information about the Gnupg-devel mailing list