From b8ec43a8599cecdf646aafb54fbe3538020afb8a Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Thu, 14 Nov 2019 14:16:17 -0800 Subject: [PATCH] remove type:ignore for working pycryptodome type I didn't dig deeper, it looks like pycryptodome must have fixed their pkcs1_15.new andd pkcs1_15.verify type signatures. --- libp2p/crypto/rsa.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libp2p/crypto/rsa.py b/libp2p/crypto/rsa.py index ec636ca..b059a18 100644 --- a/libp2p/crypto/rsa.py +++ b/libp2p/crypto/rsa.py @@ -24,8 +24,7 @@ class RSAPublicKey(PublicKey): def verify(self, data: bytes, signature: bytes) -> bool: h = SHA256.new(data) try: - # NOTE: the typing in ``pycryptodome`` is wrong on the arguments to ``verify``. - pkcs1_15.new(self.impl).verify(h, signature) # type: ignore + pkcs1_15.new(self.impl).verify(h, signature) except (ValueError, TypeError): return False return True @@ -48,8 +47,7 @@ class RSAPrivateKey(PrivateKey): def sign(self, data: bytes) -> bytes: h = SHA256.new(data) - # NOTE: the typing in ``pycryptodome`` is wrong on the arguments to ``sign``. - return pkcs1_15.new(self.impl).sign(h) # type: ignore + return pkcs1_15.new(self.impl).sign(h) def get_public_key(self) -> PublicKey: return RSAPublicKey(self.impl.publickey())