fix(tools): add key type validation and tighten test assertions in sign_firmware
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import os, sys, tempfile
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from cryptography.exceptions import InvalidSignature
|
||||
from cryptography.hazmat.primitives.asymmetric import ec
|
||||
from cryptography.hazmat.primitives import hashes, serialization
|
||||
from cryptography.hazmat.primitives.asymmetric.utils import decode_dss_signature
|
||||
@@ -59,5 +60,5 @@ def test_wrong_key_fails_verification(keypair, tmp_path):
|
||||
from cryptography.hazmat.primitives.asymmetric.utils import encode_dss_signature
|
||||
sig_der = encode_dss_signature(r, s)
|
||||
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(InvalidSignature):
|
||||
other_key.public_key().verify(sig_der, b"firmware", ec.ECDSA(hashes.SHA256()))
|
||||
|
||||
Reference in New Issue
Block a user