mkogg.py: Fix 'self.get_mp4_metadata(self, source)'
[blog.git] / posts / pgp-mime.mdwn
1 [[!meta  title="pgp-mime"]]
2 [[!template id=gitrepo repo=pgp-mime]]
3 [[!meta  date="2009-02-04 11:39:37"]]
4
5 I've been scripting up a few things recently and my inability to send
6 nicely formatted [[OpenPGP|PGP]] messages was starting to really bug
7 me.  I had been encrypting my logwatch output with `gpg` and just
8 emailing the raw `gpg` output to myself, but it's annoying to have to
9 ESC-P every time I want to decrypt a log.  The tipping point came
10 while I was writing up a script to automatically email grades out to
11 my students (not that any of the student's care about PGP, but it's
12 the principle of the thing ;), since there's no way I'm going to send
13 them raw gpg output (they would die) and there's also no way I'm going
14 to hold Mutt's hand while it signs the emails.  I dunno why Mutt
15 doesn't have some `--batch` mode options to support PGP, but there it
16 is.
17
18 Pgp-mime is my home-grown solution.  It's not very complicated really,
19 just implementing the [RFC 3156][] specs in [[Python]].  It's been
20 through a number of iterations over the years, and now (2012) I think
21 the interface has matured to the point of actually being useful to
22 other people as well ;).
23
24 While there are [some other GnuPG wrappers][wrappers] for Python, my
25 wrappers are the only ones using [the Assuan protocol][assuan] (via my
26 [[pyassuan]]) to communicate with [gpgme-tool][].  All the other
27 interfaces spawn `gpg` directly (e.g. using the [subprocess][]
28 module), and scrape its output, which is not ideal.
29
30 Pgp-mime still uses `subprocess` to spawn `gpgme-tool`, but I'm
31 currently working with the GnuPG folks to get a proper socket
32 interface which would put `gpgme-tool` on par with `gpg-agent`.  Then
33 pgp-mime could drop all the `subprocess` stuff, which would make
34 things more robust.  I'm also waiting on Python 3.3 to get support for
35 [sendmsg][] and [recvmsg][] in Python's [socket][] module, which would
36 allow me to pass file descriptors to a persistent, external
37 `gpgme-tool`.
38
39 The `README` is posted on the [PyPI page][pypi].
40
41 [[Email me|contact]] with (encrypted!) feedback.
42
43 [RFC 3156]: http://www.ietf.org/rfc/rfc3156.txt
44 [pypi]: http://pypi.python.org/pypi/pgp-mime/
45 [wrappers]: http://wiki.python.org/moin/GnuPrivacyGuard
46 [assuan]: http://www.gnupg.org/documentation/manuals/assuan/
47 [gpgme-tool]: http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=blob;f=src/gpgme-tool.c;hb=HEAD
48 [subprocess]: http://docs.python.org/library/subprocess.html
49 [sendmsg]: http://docs.python.org/dev/library/socket.html#socket.socket.sendmsg
50 [recvmsg]: http://docs.python.org/dev/library/socket.html#socket.socket.recvmsg
51 [socket]: http://docs.python.org/dev/library/socket.html
52
53 [[!tag tags/code]]
54 [[!tag tags/linux]]
55 [[!tag tags/programming]]
56 [[!tag tags/pypi]]
57 [[!tag tags/python]]