Skip to main content

RustcryptoCalExtender

Struct RustcryptoCalExtender 

Source
pub struct RustcryptoCalExtender<Base> { /* private fields */ }

Implementations§

Source§

impl RustcryptoCalExtender<WithRng<EmptyCal, StdRng>>

Source

pub fn standalone() -> Self

Creates a software-only cal, whose RNG functionality is backed by the system as chosen by rand::make_rng().

Source§

impl<Base> RustcryptoCalExtender<Base>

Source

pub const fn new_extending(base: Base) -> Self

Trait Implementations§

Source§

impl<Base: Cal> AeadProvider for RustcryptoCalExtender<Base>

Source§

type Algorithm = AeadAlgorithm<<<Base as Cal>::AeadProvider as AeadProvider>::Algorithm>

Source§

type Key = AeadKey<<<Base as Cal>::AeadProvider as AeadProvider>::Key>

Source§

type Tag = AeadTag<<<Base as Cal>::AeadProvider as AeadProvider>::Tag>

Source§

fn load_from_keydata(&mut self, alg: Self::Algorithm, key: &[u8]) -> Self::Key

Loads a key from the key’s bytes. Read more
Source§

fn encrypt_in_place( &mut self, key: &Self::Key, nonce: &[u8], message: &mut [u8], aad: impl AadGenerator, ) -> Self::Tag

Encrypts data in place. Read more
Source§

fn decrypt_in_place( &mut self, key: &Self::Key, nonce: &[u8], message: &mut [u8], tag: &[u8], aad: impl AadGenerator, ) -> Result<(), DecryptionFailed>

Decrypts data in place. Read more
Source§

impl<Base> Cal for RustcryptoCalExtender<Base>
where Base: Cal + TryCryptoRng<Error = Infallible>,

Source§

type DhProvider = RustcryptoCalExtender<Base>

The non-supertrait responsible for key establishment.
Source§

type AeadProvider = RustcryptoCalExtender<Base>

Source§

type HashProvider = RustcryptoCalExtender<Base>

Source§

type HmacProvider = RustcryptoCalExtender<Base>

Source§

fn dh(&mut self) -> &mut Self::DhProvider

Source§

fn aead(&mut self) -> &mut Self::AeadProvider

Source§

fn hash(&mut self) -> &mut Self::HashProvider

Source§

fn hmac(&mut self) -> &mut Self::HmacProvider

Source§

impl<Base> DhProvider for RustcryptoCalExtender<Base>
where Base: Cal + TryCryptoRng<Error = Infallible>,

Source§

type Algorithm = DhAlgorithm<<<Base as Cal>::DhProvider as DhProvider>::Algorithm>

Source§

type VisibleSecretKey = VisibleSecretKey<<<Base as Cal>::DhProvider as DhProvider>::VisibleSecretKey>

A secret key that is intended to be exported. Read more
Source§

type SecretKey = SecretKey<<<Base as Cal>::DhProvider as DhProvider>::SecretKey>

Source§

type PublicKey = PublicKey<<<Base as Cal>::DhProvider as DhProvider>::PublicKey>

Source§

type SharedSecret = SharedSecret<<<Base as Cal>::DhProvider as DhProvider>::SharedSecret>

Source§

fn generate_visible(&mut self, alg: Self::Algorithm) -> Self::VisibleSecretKey

Generates a secret key that is intended to be exported / shared (e.g. to be persisted across program executions).
Source§

fn export_secretkey_bytes<'s>( &mut self, secret: &'s Self::VisibleSecretKey, ) -> impl AsRef<[u8]> + use<'s, Base>

Exposes a visible secret key’s secret. Read more
Source§

fn import_secretkey_bytes( &mut self, alg: Self::Algorithm, secret: &[u8], ) -> Result<Self::VisibleSecretKey, ImportError>

Inverse operation of .export_secretkey_bytes().
Source§

fn shared_secret( &mut self, private: &Self::SecretKey, public: &Self::PublicKey, ) -> Result<Self::SharedSecret, IncompatibleKeys>

Derives a shared secret from a public and a private key. Read more
Source§

fn public_key(&mut self, private: &Self::SecretKey) -> Self::PublicKey

Produces the public key corresponding to a private key.
Source§

fn raw_secret_bytes<'s>( &mut self, secret: &'s Self::SharedSecret, ) -> impl AsRef<[u8]> + use<'s, Base>

Produces the bytes of the shared secret, in the algorithm’s .output_length(). Read more
Source§

fn export_publickey_bytes<'p>( &mut self, public: &'p Self::PublicKey, ) -> impl AsRef<[u8]> + use<'p, Base>

Exposes a public key’s key data bytes. Read more
Source§

fn import_publickey_bytes( &mut self, alg: Self::Algorithm, data: &[u8], ) -> Result<Self::PublicKey, ImportError>

Imports a public key in the inverse operation of .export_publickey_bytes().
Source§

fn generate(&mut self, alg: Self::Algorithm) -> Self::SecretKey

Generates a secret key.
Source§

impl<Base: Cal + Ec> Ec for RustcryptoCalExtender<Base>

Source§

const MAX_SCALAR_LENGTH: usize = Base::MAX_SCALAR_LENGTH

The longest slice length ever usable with scalar import / export from any of the primitives.
Source§

type PrimitivesP256 = <Base as Ec>::PrimitivesP256

Source§

type PrimitivesX25519 = <Base as Ec>::PrimitivesX25519

Source§

type PrimitivesX448 = <Base as Ec>::PrimitivesX448

Source§

fn p256(&mut self) -> &mut Self::PrimitivesP256

Source§

fn x25519(&mut self) -> &mut Self::PrimitivesX25519

Source§

fn x448(&mut self) -> &mut Self::PrimitivesX448

Source§

impl<Base: Cal + Hash> Hash for RustcryptoCalExtender<Base>

Source§

impl<Base: Cal> HashProvider for RustcryptoCalExtender<Base>

Source§

type Algorithm = HashAlgorithm<<<Base as Cal>::HashProvider as HashProvider>::Algorithm>

Source§

type State = HashState<<<Base as Cal>::HashProvider as HashProvider>::State>

State in which is carried between rounds of feeding data. Read more
Source§

type Output = HashResult<<<Base as Cal>::HashProvider as HashProvider>::Output>

Output of a hashing operation. Read more
Source§

fn init(&mut self, algorithm: Self::Algorithm) -> Self::State

Source§

fn update(&mut self, instance: &mut Self::State, data: &[u8])

Source§

fn finalize(&mut self, instance: Self::State) -> Self::Output

Source§

fn hash(&mut self, algorithm: Self::Algorithm, data: &[u8]) -> Self::Output

Hash contiguous in-memory data in a single pass. Read more
Source§

impl<Base: Cal> HmacProvider for RustcryptoCalExtender<Base>

Source§

type Algorithm = HmacAlgorithm<<<Base as Cal>::HmacProvider as HmacProvider>::Algorithm>

Source§

type Key = HmacKey<<<Base as Cal>::HmacProvider as HmacProvider>::Key>

A nascent state that has only received a key as input.
Source§

type State = HmacState<<<Base as Cal>::HmacProvider as HmacProvider>::State>

State carried between rounds of feeding data into the HMAC.
Source§

type Output = HmacResult<<<Base as Cal>::HmacProvider as HmacProvider>::Output>

Output of an HMAC operation.
Source§

fn load_from_keydata( &mut self, algorithm: Self::Algorithm, key: &[u8], ) -> Self::Key

Initializes a key from raw bytes.
Source§

fn init(&mut self, key: Self::Key) -> Self::State

Starts an HMAC operation.
Source§

fn update(&mut self, state: &mut Self::State, data: &[u8])

Source§

fn finalize(&mut self, state: Self::State) -> Self::Output

Source§

fn init_with_keydata( &mut self, algorithm: Self::Algorithm, key: &[u8], ) -> Self::State

Starts an HMAC operation based on a key that is entered as raw bytes. Read more
Source§

fn hmac_with_keydata( &mut self, algorithm: Self::Algorithm, key: &[u8], data: &[u8], ) -> Self::Output

Compute HMAC over contiguous in-memory data in a single pass, based on a key directly entered as bytes. Read more
Source§

impl<Base: Cal + Plumbing> Plumbing for RustcryptoCalExtender<Base>

Source§

impl<Base: Cal + Sha2Short> Sha2Short for RustcryptoCalExtender<Base>

Source§

const SUPPORTED: bool = Base::SUPPORTED

Whether this trait is actually supported. See Plumbing docs for rationale..
Source§

const SEND_PADDING: bool = Base::SEND_PADDING

If true, the user needs to send all the padding data into the implementation through the Self::update() function.
Source§

const FIRST_CHUNK_SIZE: usize = Base::FIRST_CHUNK_SIZE

Size of the first chunk to be sent to Self::update(), if it differs from the block size. Read more
Source§

const UPDATE_MULTICHUNK: bool = Base::UPDATE_MULTICHUNK

If true, the Self::update() function can be passed data from consecutive blocks.
Source§

type State = <Base as Sha2Short>::State

State containing an ongoing operation. Read more
Source§

fn init(&mut self, variant: Sha2ShortVariant) -> Self::State

Initiates a Self::State according to the selected algorithm.
Source§

fn update(&mut self, instance: &mut Self::State, data: &[u8])

Iteratively sends data to be hashed into the instance. Read more
Source§

fn finalize( &mut self, instance: Self::State, last_chunk: &[u8], target: &mut [u8], )

Extracts the hash into a target slice. Read more
Source§

impl<Base: Cal + TryCryptoRng> TryCryptoRng for RustcryptoCalExtender<Base>

An implementation based on getrandom.

Unlike lakers, we just require that getrandom is provided; Ariel OS’s random module shows that this can be done also on embedded platforms.

Source§

impl<Base: Cal + TryRng> TryRng for RustcryptoCalExtender<Base>

Source§

type Error = <Base as TryRng>::Error

The type returned in the event of a RNG error. Read more
Source§

fn try_next_u32(&mut self) -> Result<u32, Self::Error>

Return the next random u32.
Source§

fn try_next_u64(&mut self) -> Result<u64, Self::Error>

Return the next random u64.
Source§

fn try_fill_bytes(&mut self, dst: &mut [u8]) -> Result<(), Self::Error>

Fill dst entirely with random data.

Auto Trait Implementations§

§

impl<Base> Forget for RustcryptoCalExtender<Base>

§

impl<Base> Freeze for RustcryptoCalExtender<Base>
where Base: Freeze,

§

impl<Base> Move for RustcryptoCalExtender<Base>

§

impl<Base> RefUnwindSafe for RustcryptoCalExtender<Base>
where Base: RefUnwindSafe,

§

impl<Base> Send for RustcryptoCalExtender<Base>
where Base: Send,

§

impl<Base> Sync for RustcryptoCalExtender<Base>
where Base: Sync,

§

impl<Base> Unpin for RustcryptoCalExtender<Base>
where Base: Unpin,

§

impl<Base> UnsafeUnpin for RustcryptoCalExtender<Base>
where Base: UnsafeUnpin,

§

impl<Base> UnwindSafe for RustcryptoCalExtender<Base>
where Base: UnwindSafe,

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<R> CryptoRng for R
where R: TryCryptoRng<Error = !> + ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<H> HkdfProvider for H
where H: HmacProvider,

Source§

fn hkdf_extract( &mut self, alg: <H as HmacProvider>::Algorithm, salt: Option<&[u8]>, ikm: &[u8], ) -> Result<impl AsRef<[u8]> + use<H>, HkdfError>

HKDF-Extract (RFC 5869): returns a pseudorandom key. Read more
Source§

fn hkdf_expand( &mut self, alg: <H as HmacProvider>::Algorithm, prk: &[u8], info: &[u8], okm: &mut [u8], ) -> Result<(), HkdfError>

HKDF-Expand (RFC 5869): fills okm with derived key material.
Source§

fn hkdf( &mut self, alg: Self::Algorithm, salt: Option<&[u8]>, ikm: &[u8], info: &[u8], okm: &mut [u8], ) -> Result<(), HkdfError>

Extract then expand in one call.
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<R> Rng for R
where R: TryRng<Error = !> + ?Sized,

Source§

fn next_u32(&mut self) -> u32

Return the next random u32.
Source§

fn next_u64(&mut self) -> u64

Return the next random u64.
Source§

fn fill_bytes(&mut self, dst: &mut [u8])

Fill dest with random data. Read more
Source§

impl<R> RngCore for R
where R: Rng,

Source§

impl<R> RngExt for R
where R: Rng + ?Sized,

Source§

fn random<T>(&mut self) -> T

Return a random value via the StandardUniform distribution. Read more
Source§

fn random_iter<T>(self) -> Iter<StandardUniform, Self, T> ⓘ

Return an iterator over random variates Read more
Source§

fn random_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

Generate a random value in the given range. Read more
Source§

fn random_bool(&mut self, p: f64) -> bool

Return a bool with a probability p of being true. Read more
Source§

fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool

Return a bool with a probability of numerator/denominator of being true. Read more
Source§

fn sample<T, D>(&mut self, distr: D) -> T
where D: Distribution<T>,

Sample a new value, using the given distribution. Read more
Source§

fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T> ⓘ
where D: Distribution<T>, Self: Sized,

Create an iterator that generates values using the given distribution. Read more
Source§

fn fill<T>(&mut self, dest: &mut [T])
where T: Fill,

Fill any type implementing Fill with random data Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<R> TryRngCore for R
where R: TryRng,

Source§

type Error = <R as TryRng>::Error

👎Deprecated since 0.10.0:

use TryRng instead

Error type.