Skip to main content

DefaultCryptoProvider

Struct DefaultCryptoProvider 

Source
pub struct DefaultCryptoProvider;
Expand description

Default crypto provider backed by the crypto crate.

Provides AEAD, key exchange, hash, and signature operations.

§Examples

use tls2::crypto_default_provider::DefaultCryptoProvider;

let crypto = DefaultCryptoProvider;

Trait Implementations§

Source§

impl Clone for DefaultCryptoProvider

Source§

fn clone(&self) -> DefaultCryptoProvider

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CryptoProvider for DefaultCryptoProvider

Source§

type Hasher = Hasher

Opaque incremental hash state, must be Clone for transcript checkpointing.
Source§

type AeadKey = AeadKey

A distinct type is used to avoid computation for ench encrypt / decrypt operation for some ciphers (e.g. AES key expanding)
Source§

fn cipher_suites() -> &'static [CipherSuite]

Source§

fn signature_schemes() -> &'static [SignatureScheme]

Source§

fn key_exchange_groups() -> &'static [KeyExchangeGroup]

Source§

fn new_aead_key(&self, suite: CipherSuite, key: &[u8]) -> Self::AeadKey

Source§

fn new_hash(&self, suite: CipherSuite) -> Self::Hasher

Create a new incremental hash state for the given suite.
Source§

fn hash_update(&self, state: &mut Self::Hasher, data: &[u8])

Absorb data into the hash state.
Source§

fn hash_finalize(&self, state: Self::Hasher) -> Result<Hash, Error>

Finalize the hash and write the digest into out. Consumes the state.
Source§

fn secure_random(&self, buf: &mut [u8])

Source§

fn hash(&self, suite: CipherSuite, data: &[u8]) -> Result<Hash, Error>

One-shot hash (default implementation uses the incremental API).
Source§

fn hmac( &self, suite: CipherSuite, key: &Hash, data: &[u8], ) -> Result<Hash, Error>

Source§

fn hkdf_extract( &self, suite: CipherSuite, salt: &Hash, ikm: &[u8], ) -> Result<Hash, Error>

Source§

fn hkdf_expand_label( &self, out: &mut [u8], suite: CipherSuite, secret: &Hash, label: &[u8], context: &[u8], ) -> Result<(), Error>

Source§

fn aead_encrypt( &self, key: &Self::AeadKey, nonce: &[u8], aad: &[u8], data: &mut [u8], plaintext_len: usize, ) -> Result<usize, Error>

Source§

fn aead_decrypt( &self, key: &Self::AeadKey, nonce: &[u8], aad: &[u8], data: &mut [u8], ) -> Result<usize, Error>

Source§

fn key_exchange_generate_keypair( &self, group: KeyExchangeGroup, ) -> Result<(KeyExchangeSecretKey, KeyExchangePublicKey), Error>

Source§

fn key_exchange( &self, secret: &KeyExchangeSecretKey, peer_public: &[u8], ) -> Result<Vec<u8, KEY_EXCHANGE_SHARED_SECRET_MAX_SIZE>, Error>

Source§

fn sign( &self, scheme: SignatureScheme, secret_key: &[u8], data: &[u8], ) -> Result<Vec<u8, SIGNATURE_MAX_SIZE>, Error>

Source§

fn verify( &self, scheme: SignatureScheme, public_key: &[u8], data: &[u8], signature: &[u8], ) -> Result<(), Error>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.