Fix curve check for ES384 and ES512 verify().

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2023-08-18 13:47:55 +02:00
parent 963eae041a
commit e82f231da9
No known key found for this signature in database
GPG Key ID: C0095B7870A4CCD3
1 changed files with 2 additions and 2 deletions

View File

@ -150,7 +150,7 @@ class ES384(CoseKey):
_HASH_ALG = hashes.SHA384()
def verify(self, message, signature):
if self[-1] != 1:
if self[-1] != 2:
raise ValueError("Unsupported elliptic curve")
ec.EllipticCurvePublicNumbers(
bytes2int(self[-2]), bytes2int(self[-3]), ec.SECP384R1()
@ -177,7 +177,7 @@ class ES512(CoseKey):
_HASH_ALG = hashes.SHA512()
def verify(self, message, signature):
if self[-1] != 1:
if self[-1] != 3:
raise ValueError("Unsupported elliptic curve")
ec.EllipticCurvePublicNumbers(
bytes2int(self[-2]), bytes2int(self[-3]), ec.SECP521R1()