Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > something like perl's Mail::GPG ?

Reply
Thread Tools

something like perl's Mail::GPG ?

 
 
akonsu
Guest
Posts: n/a
 
      08-14-2009
hello,

i am looking for a module with functionality similar to that of the
Perl's Mail::GPG package. I need to verify multipart emails that are
PGP-signed.

thanks for any advice
konstantin
 
Reply With Quote
 
 
 
 
Piet van Oostrum
Guest
Posts: n/a
 
      08-14-2009
>>>>> akonsu <(E-Mail Removed)> (a) wrote:

>a> hello,
>a> i am looking for a module with functionality similar to that of the
>a> Perl's Mail::GPG package. I need to verify multipart emails that are
>a> PGP-signed.


I don't know Perl's GPG package, but to verify PGP-signed stuff you can
use gnupg. It doesn't have special code for mail messages, however. It
is just a Pythonic wrapper facade around the gpg program.

However, it doesn't do the PGP/MIME stuff, so you will have to transform
the MIME messages into something that GPG understands. This isn't hard
and you can find a short python script that does it on
http://domnit.org/2008/03/clearmime. It describes how you can use it as
a program and pipe the message through it into gpg --verify. You can
also use it as a module if you rename it to clearmime.py, and use it
with the recently released gnupg module. It is released under GPL.
However it wouldn't be hard to write something similar yourself, for
example if you want to feed it existing Message objects rather than strings.
Example:

import os
from gnupg import GPG
from clearmime import clarify

msgtxt = open('testgpg.msg').read()
cl = clarify(msgtxt)
gpg=GPG(gnupghome = os.path.join(os.environ['HOME'], '.gnupg'))

if gpg.verify(cl):
print "Signature correct"
else:
print "Signature incorrect"

--
Piet van Oostrum <(E-Mail Removed)>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I overload operators like "=>", "->" or something like that? dmitrey Python 5 04-20-2012 05:49 PM
XPath query for <?define something="something" ?> Pekka Järvinen XML 2 04-29-2008 08:12 PM
How to find and replace something that is nested inside something else? alainfri@gmail.com Perl Misc 4 05-31-2007 11:50 PM
object-like macro used like function-like macro Patrick Kowalzick C++ 5 03-14-2006 03:30 PM
umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0 C++ 4 10-13-2004 10:34 PM



Advertisments