Your piece of code was valid with the old PyCrypto; PyCryptodome is a
different package that maintains most of the original APIs of
PyCrypto, but not all and one item that is not supported is indeed the
decrypt() method of an RSA object.
Such method was implementing the insecure textbook version of RSA,
which is different than OAEP encryption, as used in the second piece
of code.
Your best bet is to simply use the old PyCrypto.
Alternatively, it should still be possible to decrypt your old data
using PyCryptodome with something like this:
from Crypto.PublicKey import RSA
rsa = RSA.importKey(open("key.der","rb").read())
encryptedNumber = int.from_bytes(encryptedData, 'big')
decryptedNumber = rsa._decrypt(encryptedNumber)
decryptedData = decryptedNumber.to_bytes(rsa.size_in_bytes(), 'big')
Hope it helps...
> --
> You received this message because you are subscribed to the Google Groups "PyCryptodome" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
pycryptodome...@googlegroups.com.
> To post to this group, send email to
pycryp...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.