From 451ec2664ad00632d1da9443d389259c2136d0ee Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Wed, 4 Sep 2019 10:19:27 -0700 Subject: [PATCH] Address incorrect typing in pycryptodome dependency --- libp2p/crypto/rsa.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libp2p/crypto/rsa.py b/libp2p/crypto/rsa.py index 8264446..9b788ca 100644 --- a/libp2p/crypto/rsa.py +++ b/libp2p/crypto/rsa.py @@ -24,7 +24,8 @@ class RSAPublicKey(PublicKey): def verify(self, data: bytes, signature: bytes) -> bool: h = SHA256.new(data) try: - pkcs1_15.new(self.impl).verify(h, signature) + # NOTE: the typing in ``pycryptodome`` is wrong on the arguments to ``verify``. + pkcs1_15.new(self.impl).verify(h, signature) # type: ignore except (ValueError, TypeError): return False return True @@ -47,7 +48,8 @@ class RSAPrivateKey(PrivateKey): def sign(self, data: bytes) -> bytes: h = SHA256.new(data) - return pkcs1_15.new(self.impl).sign(h) + # NOTE: the typing in ``pycryptodome`` is wrong on the arguments to ``sign``. + return pkcs1_15.new(self.impl).sign(h) # type: ignore def get_public_key(self) -> PublicKey: return RSAPublicKey(self.impl.publickey())