fix #675 ECDSA verification fail when padding is added

Signed-off-by: Anthony Liu <antliu@gmail.com>
This commit is contained in:
Anthony Liu 2020-03-10 11:57:26 +08:00 committed by David Brown
parent 470e2f3d5b
commit 04630cea43
1 changed files with 2 additions and 0 deletions

View File

@ -61,6 +61,8 @@ class ECDSA256P1Public(KeyClass):
return 72
def verify(self, signature, payload):
# strip possible paddings added during sign
signature = signature[:signature[1] + 2]
k = self.key
if isinstance(self.key, ec.EllipticCurvePrivateKey):
k = self.key.public_key()