MCPcopy
hub / github.com/pyca/cryptography / test_kat_vectors_87

Method test_kat_vectors_87

tests/hazmat/primitives/test_mldsa.py:273–292  ·  view source on GitHub ↗
(self, backend, subtests)

Source from the content-addressed store, hash-verified

271 pub.verify(expected_sig, msg, ctx)
272
273 def test_kat_vectors_87(self, backend, subtests):
274 vectors = load_vectors_from_file(
275 os.path.join("asymmetric", "MLDSA", "kat_MLDSA_87_det_pure.rsp"),
276 load_nist_vectors,
277 )
278 for vector in vectors:
279 with subtests.test():
280 xi = binascii.unhexlify(vector["xi"])
281 pk = binascii.unhexlify(vector["pk"])
282 msg = binascii.unhexlify(vector["msg"])
283 ctx = binascii.unhexlify(vector["ctx"])
284 sm = binascii.unhexlify(vector["sm"])
285 expected_sig = sm[:4627]
286
287 key = MLDSA87PrivateKey.from_seed_bytes(xi)
288 assert key.private_bytes_raw() == xi
289 assert key.public_key().public_bytes_raw() == pk
290
291 pub = MLDSA87PublicKey.from_public_bytes(pk)
292 pub.verify(expected_sig, msg, ctx)
293
294 @pytest.mark.parametrize("variant", ML_DSA_VARIANTS)
295 def test_kat_vectors_external_mu(self, variant, backend, subtests):

Callers

nothing calls this directly

Calls 9

load_vectors_from_fileFunction · 0.85
testMethod · 0.80
unhexlifyMethod · 0.80
from_seed_bytesMethod · 0.45
private_bytes_rawMethod · 0.45
public_bytes_rawMethod · 0.45
public_keyMethod · 0.45
from_public_bytesMethod · 0.45
verifyMethod · 0.45

Tested by

no test coverage detected