1>>> from Crypto.Signature import PKCS1_v1_5
2>>> from Crypto.Hash import SHA
3>>> from Crypto.PublicKey import RSA
4>>>
5>>> message = 'To be signed'
6>>> key = RSA.importKey(open('privkey.der').read())
7>>> h = SHA.new(message)
8>>> signer = PKCS1_v1_5.new(key)
9>>> signature = signer.sign(h)