[pycrypto] Troubles when porting from m2crypto

Priit Laes plaes at plaes.org
Tue Feb 28 09:40:13 EST 2012


Ühel kenal päeval, T, 28.02.2012 kell 01:33, kirjutas Priit Laes:
> Hey!
> 
> I'm currently in process of porting my code from m2crypt to pycrypto,
> but I have run into an issue where pycrypto doesn't seem to be returning
> correct results (tested on 32-bit Gentoo, pycrypto-2.5 + Debian 64bit
> with consistent results):

PEBKAC ^_^ :)

After trying with PKCS1_v1_5 signature, thing improved a lot.. \o/

with open('private_key.pem', 'r') as f:
    k = RSA.importKey(f.read())
    h = SHA.new(MSG)
    s = PKCS1_v1_5.new(k).sign(h)

Päikest,
Priit Laes :)


More information about the pycrypto mailing list