[][src]Crate tink_tests

Provides common methods needed in test code.

Modules

hex_string

Manual JSON deserialization for hex strings.

wycheproof_result

Manual JSON deserialization for a result enum.

Structs

DummyAead

Dummy implementation of tink_core::Aead trait.

DummyAeadKeyManager

Dummy implementation of the KeyManager trait. It returns DummyAead when primitive() functions are called.

DummyKmsClient

Dummy implementation of a tink_core::registry::KmsClient.

DummyMac

Dummy implementation of tink_core::Mac trait.

IoFailure

An object that implements std::io::Read and std::io::Write by always failing.

SharedBuf

Shared buffer, which allows Read and Write operations to happen in parallel. This also means that a cloned copy can be enclosed as a Box<dyn Read> (which is implicitly Box<dyn Read + 'static>) without lifetime concerns.

WycheproofCase

WycheproofCase represents the common elements of a tests object in a Wycheproof group. Implementations should embed (using #[serde(flatten)]) WycheproofCase in a struct that contains fields specific to the test type. See tests/wycheproofutil_test.rs for an example.

WycheproofGroup

WycheproofGroup represents the common elements of a testGroups object in a Wycheproof suite. Implementations should embed (using #[serde(flatten)]) WycheproofGroup in a struct that strongly types its list of cases. See tests/wycheproofutil_test.rs for an example.

WycheproofSuite

WycheproofSuite represents the common elements of the top level object in a Wycheproof json file. Implementations should embed (using #[serde(flatten)]) WycheproofSuite in a struct that strongly types the testGroups field. See tests/wycheproofutil_test.rs for an example.

Enums

WycheproofResult

WycheproofResult represents the possible result values for a Wycheproof test case.

Constants

AES_CMAC_KEY_VERSION

Maximal version of HMAC keys that Tink supports.

AES_CMAC_PRF_KEY_VERSION

Maximal version of AES CMAC PRF keys that Tink supports.

AES_CMAC_PRF_TYPE_URL

Type URL of AES CMAC PRF keys.

AES_CMAC_TYPE_URL

Type URL of AES-CMAC keys.

AES_CTR_HMAC_AEAD_KEY_VERSION

Maximal version of AES-CTR-HMAC-AEAD keys that Tink supports.

AES_CTR_HMAC_AEAD_TYPE_URL

Type URL of AES-CTR-HMAC-AEAD keys that Tink supports.

AES_CTR_HMAC_KEY_VERSION

Maximum version of AES-CTR-HMAC keys that Tink supports.

AES_CTR_HMAC_TYPE_URL

Type URL of AES-CTR-HMAC keys that Tink supports.

AES_GCM_HKDF_KEY_VERSION

Maximum version of AES-GCM-HKDF keys that Tink supports.

AES_GCM_HKDF_TYPE_URL

Type URL of AES-GCM-HKDF keys that Tink supports.

AES_GCM_KEY_VERSION

Maximal version of AES-GCM keys.

AES_GCM_SIV_KEY_VERSION

Maximal version of AES-GCM-SIV keys.

AES_GCM_SIV_TYPE_URL

Type URL of AES-GCM-SIV keys that Tink supports.

AES_GCM_TYPE_URL

Type URL of AES-GCM keys that Tink supports.

AES_SIV_KEY_VERSION

Maximal version of AES-SIV keys that Tink supports.

AES_SIV_TYPE_URL

Type URL of AES-SIV keys.

CHA_CHA20_POLY1305_KEY_VERSION

Maximal version of ChaCha20Poly1305 keys that Tink supports.

CHA_CHA20_POLY1305_TYPE_URL

Type URL of ChaCha20Poly1305 keys.

ECDSA_SIGNER_KEY_VERSION

Maximum version of ECDSA private keys that Tink supports.

ECDSA_SIGNER_TYPE_URL

Type URL of ECDSA private keys.

ECDSA_VERIFIER_KEY_VERSION

Maximum version of ECDSA public keys that Tink supports.

ECDSA_VERIFIER_TYPE_URL

Type URL of ECDSA public keys.

ECIES_AEAD_HKDF_PRIVATE_KEY_KEY_VERSION

Maximal version of keys that this key manager supports.

ECIES_AEAD_HKDF_PRIVATE_KEY_TYPE_URL

Type URL that this key manager supports.

ECIES_AEAD_HKDF_PUBLIC_KEY_KEY_VERSION

Maximal version of keys that this key manager supports.

ECIES_AEAD_HKDF_PUBLIC_KEY_TYPE_URL

Type url that this key manager supports.

ED25519_SIGNER_KEY_VERSION

Maximum version of ED25519 private keys that Tink supports.

ED25519_SIGNER_TYPE_URL

Type URL of ED25519 private keys.

ED25519_VERIFIER_KEY_VERSION

Maximum version of ED25519 public keys that Tink supports.

ED25519_VERIFIER_TYPE_URL

Type URL of ED25519 public keys.

HKDF_PRF_KEY_VERSION

Maximal version of HKDF PRF keys that Tink supports.

HKDF_PRF_TYPE_URL

Type URL of HKDF PRF keys.

HMAC_KEY_VERSION

Maximal version of HMAC keys that Tink supports.

HMAC_PRF_KEY_VERSION

Maximal version of HMAC PRF keys that Tink supports.

HMAC_PRF_TYPE_URL

Type URL of HMAC PRF keys.

HMAC_TYPE_URL

Type URL of HMAC keys.

KMS_ENVELOPE_AEAD_KEY_VERSION

Maximal version of KMSEnvelopeAEAD keys that Tink supports.

KMS_ENVELOPE_AEAD_TYPE_URL

Type URL of KMSEnvelopeAEAD keys.

UPSTREAM_VERSION

The upstream Tink version that this Rust port is based on.

X_CHA_CHA20_POLY1305_KEY_VERSION

Maximal version of XChaCha20Poly1305 keys that Tink supports.

X_CHA_CHA20_POLY1305_TYPE_URL

Type URL of XChaCha20Poly1305 keys.

Functions

ecies_aead_hkdf_private_key

Return an EciesAeadHkdfPrivateKey with specified parameters

ecies_aead_hkdf_public_key

Return a EciesAeadHkdfPublicKey with specified parameters.

expect_err

Check for an expected error.

expect_err_for_case

Check for an expected error in a particular test case.

generate_ecies_aead_hkdf_private_key

Generate a new EC key pair and returns the private key proto.

generate_mutations

Generate different byte mutations for a given byte array.

get_ecdsa_params

Return the enum representations of each parameter in the given EcdsaParams.

new_aes_cmac_key

Create a new AesCmacKey with the specified parameters.

new_aes_cmac_key_format

Create a new AesCmacKeyFormat with the specified parameters.

new_aes_cmac_params

Return a new AesCmacParams.

new_aes_cmac_prf_key

Create a new AesCmacPrfKey with the specified parameters.

new_aes_cmac_prf_key_format

Create a new AesCmacPrfKeyFormat with the specified parameters.

new_aes_ctr_hmac_key

Create a randomly generated AesCtrHmacStreamingKey.

new_aes_ctr_hmac_key_format

Return a new AesCtrHmacStreamingKeyFormat.

new_aes_gcm_hkdf_key

Create a randomly generated AesGcmHkdfStreamingKey.

new_aes_gcm_hkdf_key_data

Create a KeyData containing a randomly generated AesGcmHkdfStreamingKey.

new_aes_gcm_hkdf_key_format

Return a new AesGcmHkdfStreamingKeyFormat.

new_aes_gcm_key

Create a randomly generated AesGcmKey.

new_aes_gcm_key_data

Create a KeyData containing a randomly generated AesGcmKey.

new_aes_gcm_key_format

Return a new AesGcmKeyFormat.

new_aes_gcm_siv_key

Create a randomly generated AesGcmSivKey.

new_aes_gcm_siv_key_data

Create a KeyData containing a randomly generated AesGcmSivKey.

new_aes_gcm_siv_key_format

Return a new AesGcmSivKeyFormat.

new_dummy_key

Return a dummy key that doesn't contain actual key material.

new_ecdsa_key_format

Create an EcdsaKeyFormat with the specified parameters.

new_ecdsa_params

Create an EcdsaParams with the specified parameters.

new_ed25519_private_key

Create an Ed25519PrivateKey with randomly generated key material.

new_ed25519_public_key

Create an Ed25519PublicKey with randomly generated key material.

new_hkdf_prf_key

Create a new HkdfPrfKey with the specified parameters.

new_hkdf_prf_key_format

Create a new HkdfPrfKeyFormat with the specified parameters.

new_hkdf_prf_params

Return a new HkdfPrfParams.

new_hmac_key

Create a new HmacKey with the specified parameters.

new_hmac_key_data

Return a new KeyData that contains a HmacKey.

new_hmac_key_format

Create a new HmacKeyFormat with the specified parameters.

new_hmac_keyset_manager

Return a new tink_core::keyset::Manager that contains a HmacKey.

new_hmac_params

Return a new HmacParams.

new_hmac_prf_key

Create a new HmacPrfKey with the specified parameters.

new_hmac_prf_key_format

Create a new HmacPrfKeyFormat with the specified parameters.

new_hmac_prf_params

Return a new HmacPrfParams.

new_key

Create a new Key with the specified parameters.

new_key_data

Create a new KeyData with the specified parameters.

new_keyset

Create a new Keyset with the specified parameters.

new_random_ecdsa_private_key

Create an EcdsaPrivateKey with randomly generated key material.

new_random_ecdsa_public_key

Create an EcdsaPublicKey with randomly generated key material.

new_serialized_aes_gcm_siv_key

Create an AesGcmSivKey with randomly generated key material.

new_test_aes_gcm_hkdf_keyset

Create a new Keyset containing an AesGcmHkdfKey.

new_test_aes_gcm_keyset

Create a new Keyset containing an AesGcmKey.

new_test_aes_siv_keyset

Create a new Keyset containing an AesSivKey.

new_test_hmac_keyset

Create a new Keyset containing an HmacKey.

new_test_keyset

Create a new test Keyset, generating fresh KeyData for each key using the provided key_data_generator.

proto_encode

Convert a protocol buffer message to its serialized form.

wycheproof_data

Retrieve Wycheproof test vectors from the given filename. The location of the Wycheproof repository is assumed to be "../wycheproof/" relative to the crate manifest file, but this can be overridden with the the WYCHEPROOF_DIR environment variable.

z_test_autocorrelation_uniform_string

Test whether the autocorrelation of a string points to the bits being independent and uniformly distributed. Rotates the string in a cyclic fashion. Returns non ok status if the z test fails by more than 10 standard deviations.

z_test_crosscorrelation_uniform_strings

Test that the cross-correlation of two byte strings of equal length points to independent and uniformly distributed strings. Returns non Ok status if the z test fails by more than 10 standard deviations.

z_test_uniform_string

Use a z test on the given byte string, expecting all bits to be uniformly set with probability 1/2. Returns non ok status if the z test fails by more than 10 standard deviations.