<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
<link rel="alternate" type="text/html" href="https://emergent.unpythonic.net/"/>

<title>Jeff Epler's blog</title>
<modified>2014-02-24T13:10:37Z</modified>
<tagline>Photos, electronics, cnc, and more</tagline>
<author><name>Jeff Epler</name><email>jepler@unpythonic.net</email></author>
<entry>
<title>How do you check a signature on a PGP/Mime message</title>
<issued>2014-02-24T13:10:37Z</issued>
<modified>2014-02-24T13:10:37Z</modified>
<id>https://emergent.unpythonic.net/01393247437</id>
<link rel="alternate" type="text/html" href="https://emergent.unpythonic.net/01393247437"/>
<content type="text/html" mode="escaped">


&lt;p&gt;…I'll answer in Python.  First, put your whole message in a file in unix &amp;quot;mbox&amp;quot;
format (this will be the problem if you use some brain-dead GUI mailer!), then
in Python extract the signature and the signed message, and finally invoke gpg:
&lt;pre&gt;
import email
import os
import sys

with open(sys.argv[1]) as mfile: message = email.message_from_file(mfile)

if message.get_content_type() != &quot;multipart/signed&quot;:
    raise SystemExit, &quot;message not signed&quot;

# Really, you'd want safe temporary filenames, and you'd want to clean them up
with open(&quot;msg&quot;, &quot;wb&quot;) as msg: msg.write(message.get_payload(0).as_string())
with open(&quot;sig&quot;, &quot;wb&quot;) as sig: sig.write(message.get_payload(1).get_payload())

# Delegate the real business to gpg
os.execvp(&quot;gpg&quot;, [&quot;gpg&quot;, &quot;--verify&quot;, &quot;sig&quot;, &quot;msg&quot;])
&lt;/pre&gt;

&lt;p&gt;</content>
</entry>
<entry>
<title>GPG Key</title>
<issued>2013-04-02T14:15:09Z</issued>
<modified>2013-04-02T14:15:09Z</modified>
<id>https://emergent.unpythonic.net/01364912109</id>
<link rel="alternate" type="text/html" href="https://emergent.unpythonic.net/01364912109"/>
<content type="text/html" mode="escaped">
I've been spending some time working on Debian stuff, particularly packaging
and porting for Debian kFreeBSD.  Some time in the future I might wish to
become a Debian Maintainer, and a step along the way is to begin using a GPG
key.

&lt;p&gt;To that end, here's the fingerprint of my key, which is also uploaded to
sks-keyservers.net:</content>
</entry>
</feed>
