pycryptodome
pycryptodome copied to clipboard
Comparing ECC and RSA keys
>>> 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.