Skip to content

Commit 1b501fa

Browse files
Merge commit from fork
* Use official time-safe HMAC Verification API * Switch to official constant time HMAC verification API --------- Co-authored-by: ahacker1 <[email protected]>
1 parent 43e06b4 commit 1b501fa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

signxml/verifier.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,10 @@ def verify(
473473

474474
signer = HMAC(key=ensure_bytes(self.hmac_key), algorithm=digest_algorithm_implementations[signature_alg]())
475475
signer.update(signed_info_c14n)
476-
if raw_signature == signer.finalize():
476+
try:
477+
signer.verify(raw_signature)
477478
verified_signed_info_c14n = signed_info_c14n
478-
else:
479+
except cryptography.exceptions.InvalidSignature:
479480
raise InvalidSignature("Signature mismatch (HMAC)")
480481
else:
481482
if key_value is None and der_encoded_key_value is None:

0 commit comments

Comments
 (0)