Reading key capabilities information before importing a key

Branko Majic branko at
Thu Apr 11 22:48:42 CEST 2013

On Thu, 11 Apr 2013 09:55:23 +0200
Werner Koch <wk at> wrote:

> On Thu, 11 Apr 2013 00:28, mailinglisten at said:
> > 2) You import the key but direct it to a different keyring, see
> > --keyring
> > --secret-keyring
> > --primary-keyring
> > --no-default-keyring
> You better use a temporary directory.  This is far easier than to play
> with all the options and it allows you to use gpgme.
> Another option is to import the key and then delete it if you don't
> want it.  However, we have a --merge-only option but not a
> --only-new-key-option.

Hm... Certainly looks better than parsing the --list-packets output.
The background of this question is that I'm working on small
helper/wrapper utility script for encrypting data and storing it in git
repository. This includes having a small local .gnupg in the repository
where the public keys for encryption are stored.

The script includes commands for adding/removing a key from that local
directory keyring, so I was hoping to check the keys being imported to
it for key capabilities.

I'm thinking of trying out the gpgme library, Python bindings to be
more precise, but I'm not sure if I could get all
information/functionality as using GnuPG CLI.

Btw, is there any particular reason why the gpg2 --with-colons
command does not list key capabilities?

Thanks for all the answers :)

Best regards

Branko Majic
Jabber: branko at
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: branko at
Молим вас да додатке шаљете искључиво у слободним форматима.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: </pipermail/attachments/20130411/02006552/attachment.sig>

More information about the Gnupg-users mailing list