Color scheme: Light
You are here: start » en » Documentation » Post-Quantum Cryptography » WvdS Crypto Service overview » How-to guides » Verify the test vectors

Verify the test vectors

l4re/crypto_test_vectors.json contains complete requests and responses of the binary protocol, byte for byte, together with the keys involved. Integrators use them as a reference for their own implementation. This guide shows how to recompute the vectors independently of the service and how to regenerate them.

What the file contains

GroupCountPer vector
AES-256-GCM4key, request 0x01, response with nonce, tag, and ciphertext
ML-DSA2ML-DSA-65 and ML-DSA-44: key pair, request 0x10, response with signature
ML-KEM2ML-KEM-768 and ML-KEM-1024: key pair, request 0x20, response with shared secret and ciphertext

The file also holds three RSA test certificates. All keys are test keys and have no place in a production system.

ML-DSA signs hedged, so the same message produces a different signature on every run. Check signatures by verifying them, not by comparing bytes.

Recompute independently

tools/verify-test-vectors.py recomputes every vector with a libcrypto of your choice, without any code from the service. Preferably, use a different OpenSSL version than the one the vectors were generated with.

python tools/verify-test-vectors.py l4re/crypto_test_vectors.json "C:\Program Files\OpenSSL\bin\libcrypto-3-x64.dll"
python3 tools/verify-test-vectors.py l4re/crypto_test_vectors.json /usr/lib/x86_64-linux-gnu/libcrypto.so.3

The script decrypts every AES vector, verifies every signature and rejects it for a modified message, and decapsulates every ML-KEM ciphertext. On success, it ends with 8 vectors, 0 failures and exit code

  1. The libcrypto must support ML-DSA and ML-KEM, which means OpenSSL 3.5 or later.

Regenerate

cd l4re
cargo test --test crypto_test_vectors test_export_full_suite -- --ignored

The test rewrites crypto_test_vectors.json with fresh keys and the generation time in the created field. Before writing, it verifies every signature, decapsulates every ciphertext, and checks the sizes against the service's size constants, which also appear in wvds_crypto.h. Then check the result with the script above.

en/wiki/pqcrypt/svc/how-to/verify-test-vectors.txt · Last modified: by Wolfgang van der Stille