Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Attribute Error 'can_decrypt' (RSA key) #114

Open
ayr0 opened this issue Jan 6, 2015 · 2 comments
Open

Attribute Error 'can_decrypt' (RSA key) #114

ayr0 opened this issue Jan 6, 2015 · 2 comments

Comments

@ayr0
Copy link

ayr0 commented Jan 6, 2015

from Crypto.Cipher import PKCS1_OAEP as oaep
from Crypto.PublicKey import RSA
key = RSA.generate(2048)
pkcs = oaep.new(key)
pkcs.can_decrypt()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-233-a54ca29e70fc> in <module>()
----> 1 pkcs.can_decrypt()

/usr/lib/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyc in can_decrypt(self)
    109     def can_decrypt(self):
    110         """Return True/1 if this cipher object can be used for decryption."""
--> 111         return self._key.can_decrypt()
    112 
    113     def encrypt(self, message):

/usr/lib/python2.7/site-packages/Crypto/PublicKey/RSA.pyc in __getattr__(self, attrname)
    124             return getattr(self.key, attrname)
    125         else:
--> 126             raise AttributeError("%s object has no %r attribute" % (self.__class__.__name__, attrname,))
    127 
    128     def encrypt(self, plaintext, K):

AttributeError: _RSAobj object has no 'can_decrypt' attribute

An RSA key object has no 'can_decrypt' attribute.

@ayr0 ayr0 changed the title Attribute Error Attribute Error 'can_decrypt' (RSA key) Jan 6, 2015
@ayr0
Copy link
Author

ayr0 commented Jan 6, 2015

I can fix if needed, I just don't know what the design decision should be. Should I add an attribute to RSA keys?

@vshivam
Copy link

vshivam commented Mar 6, 2015

Any fixes for this ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants