0

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?

asked Jul 16, 2014 at 23:51

1 Answer 1

1

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.

answered Jul 16, 2014 at 23:53
Sign up to request clarification or add additional context in comments.

1 Comment

So i would need to pass an 'instance' to the PKCS1_OAEP.new() function ?, is there anyway to convert the PK_ID to this for it to be acepted ?

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.