Domain Keys in Python

Nikita the Spider NikitaTheSpider at
Fri Apr 20 17:51:30 CEST 2007

In article <mailman.6767.1177059715.32031.python-list at>,
 Andrew Veitch <andrew.veitch at> wrote:

> I am trying to implement Domain Keys
> ( in Python.
> In Perl I would just use Crypt:RSA which has a sign
> method with an armour option which generates exactly
> what I want but I can't find a way of doing this in
> Python.
> I tried this:
> from M2Crypto import RSA
> key = RSA.load_key('rsa.private')
> msg='Hello world'
> print key.sign(msg)
> But the output isn't quite right because there isn't
> an armour option - I verified this by reading the
> source.
> I'm not even sure if M2Crypto is the right library to
> be using or is it just that I need to use something
> else for the final step?

Hi Andrew,
There's also pycrypto for doing RSA encryption:

I messed around with this for a little while but decided I didn't need 
it. ISTR figuring out that it does not implement any padding; is this 
perhaps the armour option you're talking about? I'm not a cryptographer 
and I don't even play one on TV, so the accuracy of this is probably 
even less reliable than an average Usenet posting...

Good luck

Whole-site HTML validation, link checking and more

More information about the Python-list mailing list