Skip to content

Commit

Permalink
add tests for the new vectors (#10135)
Browse files Browse the repository at this point in the history
just verifying basic loading works for these curve names
  • Loading branch information
reaperhulk authored Jan 5, 2024
1 parent 30e5ee2 commit 98b6354
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/hazmat/primitives/test_ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,27 @@ def test_load_private_key_unsupported_curve(self):
mode="rb",
)

@pytest.mark.parametrize(
("key_file", "curve"),
[
("sect163k1-spki.pem", ec.SECT163K1),
("sect163r2-spki.pem", ec.SECT163R2),
("sect233k1-spki.pem", ec.SECT233K1),
("sect233r1-spki.pem", ec.SECT233R1),
],
)
def test_load_public_keys(self, key_file, curve, backend):
_skip_curve_unsupported(backend, curve())
key = load_vectors_from_file(
os.path.join("asymmetric", "EC", key_file),
lambda pemfile: serialization.load_pem_public_key(
pemfile.read(),
),
mode="rb",
)
assert isinstance(key, ec.EllipticCurvePublicKey)
assert isinstance(key.curve, curve)


class TestEllipticCurvePEMPublicKeySerialization:
@pytest.mark.parametrize(
Expand Down

0 comments on commit 98b6354

Please sign in to comment.