Crate wycheproof[−][src]
Expand description
Wycheproof test vectors
Wycheproof is a set of cryptographic tests created by a team at Google which checks for common bugs and corner cases in cryptographic code.
This crate is a convenient repacking of the Wycheproof JSON-formatted test data with deserialization to easily usable structs.
Hex and base64 encoded data is all decoded to binary Vec<u8>
for your
convenience. Large integers (such as those used in the primality tests) are
left as big-endian byte arrays rather than being decoded to num_bigint
due
to the proliferation of different multi-precision integers libraries in use
in the Rust ecosystem.
Each submodule of this crate includes a set of structs: a TestName
which
specifies which individual test is desired, a TestSet
which is the set of
data associated with the TestName
. Each TestSet
contains one or more
TestGroups
, which in turn contain some amount of test-specific
configuration information along with a list of Test
which are the actual
tests.
Each test has an expected result which is either Valid
, Invalid
, or
Acceptable
. Acceptable
just means that the test is technically valid but
might still be rejected for various reasons, for instance because the hash
function that was used is too weak for proper security.
Examples
fn print_gcm() { // Print all AES-GCM test vector data let test_set = wycheproof::aead::TestSet::load(wycheproof::aead::TestName::AesGcm).unwrap(); for test_group in test_set.test_groups { println!( "* Group key size:{} tag size:{} nonce size:{}", test_group.key_size, test_group.tag_size, test_group.nonce_size, ); for test in test_group.tests { println!( "Test:{} Key:{} AAD:{} PT:{} CT:{} Tag:{}", test.tc_id, hex::encode(test.key), hex::encode(test.aad), hex::encode(test.pt), hex::encode(test.ct), hex::encode(test.tag) ); } } }
// Iterate over all of the AEAD tests for aead in wycheproof::aead::TestName::all() { println!("{:?}", aead); }
Modules
AEAD tests
IND-CPA cipher tests
Deterministic AEAD tests
DSA verification tests
ECDH key agreement tests
ECDSA tests
EdDSA verification tests
HKDF tests
NIST keywrapping tests
Message Authentication Code tests
Primality checking tests
RSA OAEP decryption tests
RSA PKCS1v1.5 decryption tests
RSA PKCS1v1.5 signature generation tests
RSA PKCS1v1.5 verification tests
RSA PSS verification tests
Montgomery curve ECDH tests
Structs
Enums
Edwards curves
Prime order elliptic curves
Hash Function identifiers
MGF identifiers
Montgomery curves
The expected result of a Wycheproof test
The error type