pycryptodome icon indicating copy to clipboard operation
pycryptodome copied to clipboard

Comparing ECC and RSA keys

Open Akuli opened this issue 3 years ago • 0 comments

>>> from Crypto.PublicKey import ECC, RSA
>>> ECC.generate(curve='p384') == RSA.generate(bits=4096)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/a/foo/env/lib/python3.10/site-packages/Crypto/PublicKey/ECC.py", line 807, in __eq__
    return other.pointQ == self.pointQ
AttributeError: 'RsaKey' object has no attribute 'pointQ'

Presumably EccKey's __eq__ should do an isinstance() check, and return False (or even better, NotImplemented) when the argument is not an EccKey object.

Akuli avatar Aug 18 '22 14:08 Akuli