Accessing GnuPG from Python

Frank Tobin ftobin at uiuc.edu
Sun Aug 20 20:35:28 CEST 2000


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Morten W. Petersen, at 23:46 +0200 on Sat, 19 Aug 2000, wrote:

> > 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.

Speaking as a developer who has written two Perl interface-libraries to
GnuPG, I've been through the scenario where my class design required a
total rewrite/redesign.  If you are interested in what I came up with in
my rewrite, if you know Perl, you might want to take a look at
GnuPG::Interface.

Basically, the structure of a GnuPG::Interface object-system looks like
this:

GnuPG::Interface object:
  methods:
      encrypt
      sign
      clearsign
      (etc; all GnuPG CLI syntax-commands)
  data members:
    gnupg_call
    passphrase
    GnuPG::Options object

Each GnuPG::Interface method takes a GnuPG::Handles object, which can hold
pipes for stdin, stderr, stdout, passphrase-fd, status-fd, and logger-fd.
There is also key-object hierarchy, but that isn't that necessary to basic
GnuPG interaction.

GnuPG::Object
  methods:
      none
  data_members:
    armor
    recipients
    comment
    interactive
    (etc; many GnuPG::Options)
    extra_args
    meta_pgp_5_compatible
    meta_pgp_2_compatible
    meta_interactive

The GnuPG::Options "barename" data members correspond to basic GnuPG
options.  The "meta_" options refer to collections of options that will be
enabled; these are designed by me, the designer of the developer, for ease
of use.  The extra_args is a basic array of options that will be pass in
if the library does not support some options.

I hope that this may give you something to think about; I totally scrapped
my PGP::GPG::MessageProcessor module, which was not extensible enough to
handle the changes in GnuPG; GnuPG::Interface tries to solve that by
creating a design that is similar to GnuPG's CLI-API.

- -- 
Frank Tobin		http://www.uiuc.edu/~ftobin/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (FreeBSD)
Comment: pgpenvelope 2.9.0 - http://pgpenvelope.sourceforge.net/

iEYEARECAAYFAjmgeVgACgkQVv/RCiYMT6OUlwCdGWVUzcTaRVgPMCdNWvtgvqbY
L3oAn0TTvOuuPcFBVvoSxlg1fexWPBXP
=nPkj
-----END PGP SIGNATURE-----



More information about the Gnupg-devel mailing list