Reputation: 77
I am getting the error :
data = cipher.encrypt(data)
File "/usr/lib/python2.7/dist-packages/Crypto/Cipher/PKCS1_OAEP.py", line 133, in encrypt
randFunc = self._key._randfunc
AttributeError: 'str' object has no attribute '_randfunc'
in my console for the following section of code:
cipher = PKCS1_OAEP.new(PK_ID)
data = cipher.encrypt(data)
both the PK_ID and data are both of Str
what does the error message mean and how can i solve it for this code?
Upvotes: 0
Views: 1546
Reputation: 15009
The PKCS1_OAEP.new()
function takes an RSA key object, which you can get from the Crypto.PublicKey.RSA
module, it doesn't take a str
.
Upvotes: 1