Domain Keys in Python

Andrew Veitch andrew.veitch at
Fri Apr 20 21:58:02 CEST 2007

--- Andrew Veitch <andrew.veitch at> wrote:

> 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've worked it out, just for the archives the answer

import base64
from M2Crypto import RSA
key = RSA.load_key('rsa.private')
msg='Hello world'
print base64.b64encode(key.sign(msg))

I will publish my DomainKey implementation shortly.


More information about the Python-list mailing list