Search code examples
pythonbatch-filegnupgpgp

Using gpg --search-keys in --batch mode


I'm working on an application that will eventually graph the gpg signature connections between a predefined set of email addresses. I need it to programmatically collect the public keys from a key server. I have a working model that will use the --search-keys option to gpg. However, when run with the --batch flag, I get the error "gpg: Sorry, we are in batchmode - can't get input". When I run with out the --batch flag, gpg expects input.

I'm hoping there is some flag to gpg that I've missed. Alternatively, a library (preferably python) that will interact with a key server would do.


Solution

  • GnuPG is not performing very well anyway when you import very large portions of the web of trust, especially during the import phase.

    I'd go for setting up a local keyserver, just dumping all the keys in there (less than 10GB of download size in 2014) and directly querying your own, local keyserver.

    Hockeypuck is rather easy to setup and especially query, as it stores the data in a PostgreSQL database.