pub trait HpkeCrypto: Debug + Send + Sync {
    type HpkePrng: RngCore + CryptoRng + HpkeTestRng;
Show 16 methods fn supports_kdf(alg: KdfAlgorithm) -> Result<(), Error>;
fn supports_kem(alg: KemAlgorithm) -> Result<(), Error>;
fn supports_aead(alg: AeadAlgorithm) -> Result<(), Error>;
fn prng() -> Self::HpkePrng;
fn kdf_extract(alg: KdfAlgorithm, salt: &[u8], ikm: &[u8]) -> Vec<u8>;
fn kdf_expand(
        alg: KdfAlgorithm,
        prk: &[u8],
        info: &[u8],
        output_size: usize
    ) -> Result<Vec<u8>, Error>;
fn kem_derive(
        alg: KemAlgorithm,
        pk: &[u8],
        sk: &[u8]
    ) -> Result<Vec<u8>, Error>;
fn kem_derive_base(alg: KemAlgorithm, sk: &[u8]) -> Result<Vec<u8>, Error>;
fn kem_key_gen(
        alg: KemAlgorithm,
        prng: &mut Self::HpkePrng
    ) -> Result<Vec<u8>, Error>;
fn kem_validate_sk(alg: KemAlgorithm, sk: &[u8]) -> Result<Vec<u8>, Error>;
fn aead_seal(
        alg: AeadAlgorithm,
        key: &[u8],
        nonce: &[u8],
        aad: &[u8],
        msg: &[u8]
    ) -> Result<Vec<u8>, Error>;
fn aead_open(
        alg: AeadAlgorithm,
        key: &[u8],
        nonce: &[u8],
        aad: &[u8],
        msg: &[u8]
    ) -> Result<Vec<u8>, Error>; fn kdf_digest_length(alg: KdfAlgorithm) -> usize { ... }
fn aead_key_length(alg: AeadAlgorithm) -> usize { ... }
fn aead_nonce_length(alg: AeadAlgorithm) -> usize { ... }
fn aead_tag_length(alg: AeadAlgorithm) -> usize { ... }
}
Expand description

The HpkeCrypto trait defines the necessary cryptographic functions used in the HPKE implementation.

Associated Types

The PRNG implementation returned in HpkeCrypto::prng().

Required methods

Returns an error if the KDF algorithm is not supported by this crypto provider.

Returns an error if the KEM algorithm is not supported by this crypto provider.

Returns an error if the AEAD algorithm is not supported by this crypto provider.

Get a stateful PRNG. Note that this will create a new PRNG state.

KDF Extract

KDF Expand

KEM Derive

KEM Derive with base

KEM Key generation

Validate a secret key for its correctness.

AEAD encrypt.

AEAD decrypt.

Provided methods

Get the length of the output digest.

Get key length for AEAD.

Note that this function returns 0 for export only keys of unknown size.

Get key length for AEAD.

Note that this function returns 0 for export only nonces of unknown size.

Get key length for AEAD.

Note that this function returns 0 for export only tags of unknown size.

Implementors