Accessing GnuPG from Python

Morten W. Petersen morten at
Sun Aug 20 00:46:10 CEST 2000

On Fri, 18 Aug 2000, Th. Fischer wrote:

> There is a file which says:
> $gpg -> gen_key (trace => 1, passphrase => PASSWD, name => USERID);
> And it is working.
> GnuPG version 1.0.2 has a file 'DETAILS' in its 'doc' directory
> showing an approach using batch files for key generation.

Yes, I see it.  Hmm, seems pretty straighforward.  But the 'DETAILS' file
also says "Please don't complain if we decide to change the behaviour for
this command.".  Also, if we are to use the command line and the key
generation file approach, it will, IMO be ugly and complex.  Then we have
Python, file syntax and GnuPG to worry about.  Not to mention the
temporary FIFO and key generation files (read: security problem).

I'd much rather use a cleaner approach, with Python->GPGLib, a lib which
we derive from the GnuPG source.  I wonder if the GnuPG developers would
be interested in splitting GnuPG into a lib and a CLI interface.

>  > > For the moment, I only got the idea, the will and the spare time to
>  > > create a Python module. What do you have got so far?
>  > Well, I've got alot of time, I'm doing this for a contract, so I'm
>  > definently in =).  What I've got so far?  The idea, some Python->C
>  > experience, and _a lot of will_.
> Nice place to start! As long as it will be GPL, I am in as well.

But ofcourse.

> More hints on how to access GnuPG via C could be derived from
> the code of GPA, the GNU Privacy Assistant, which is developed
> as a graphical frontend for GnuPG. Available at

Yes, but the GPA accesses the gpg program, via pipes, and not
library functions.

> On the first run we should decide on the API(s) of our class(es).
> Maybe it's your turn now to present the first skeleton for this,
> for I am now off for the cinema. We should stick to the command
> line names for the methods - obviously.

I'm building up Zen.  Interface is everything so I want to make sure it's
done the right way the first time.  I'll get back to you in the start of
next week with some suggestions.


More information about the Gnupg-devel mailing list