pub struct RustcryptoCalExtender<Base> { /* private fields */ }Implementations§
Source§impl RustcryptoCalExtender<WithRng<EmptyCal, StdRng>>
impl RustcryptoCalExtender<WithRng<EmptyCal, StdRng>>
Sourcepub fn standalone() -> Self
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>
impl<Base> RustcryptoCalExtender<Base>
pub const fn new_extending(base: Base) -> Self
Trait Implementations§
Source§impl<Base: Cal> AeadProvider for RustcryptoCalExtender<Base>
impl<Base: Cal> AeadProvider for RustcryptoCalExtender<Base>
type Algorithm = AeadAlgorithm<<<Base as Cal>::AeadProvider as AeadProvider>::Algorithm>
type Key = AeadKey<<<Base as Cal>::AeadProvider as AeadProvider>::Key>
type Tag = AeadTag<<<Base as Cal>::AeadProvider as AeadProvider>::Tag>
Source§fn load_from_keydata(&mut self, alg: Self::Algorithm, key: &[u8]) -> Self::Key
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
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>
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>
impl<Base> Cal for RustcryptoCalExtender<Base>
Source§type DhProvider = RustcryptoCalExtender<Base>
type DhProvider = RustcryptoCalExtender<Base>
The non-supertrait responsible for key establishment.
type AeadProvider = RustcryptoCalExtender<Base>
type HashProvider = RustcryptoCalExtender<Base>
type HmacProvider = RustcryptoCalExtender<Base>
fn dh(&mut self) -> &mut Self::DhProvider
fn aead(&mut self) -> &mut Self::AeadProvider
fn hash(&mut self) -> &mut Self::HashProvider
fn hmac(&mut self) -> &mut Self::HmacProvider
Source§impl<Base> DhProvider for RustcryptoCalExtender<Base>
impl<Base> DhProvider for RustcryptoCalExtender<Base>
type Algorithm = DhAlgorithm<<<Base as Cal>::DhProvider as DhProvider>::Algorithm>
Source§type VisibleSecretKey = VisibleSecretKey<<<Base as Cal>::DhProvider as DhProvider>::VisibleSecretKey>
type VisibleSecretKey = VisibleSecretKey<<<Base as Cal>::DhProvider as DhProvider>::VisibleSecretKey>
A secret key that is intended to be exported. Read more
type SecretKey = SecretKey<<<Base as Cal>::DhProvider as DhProvider>::SecretKey>
type PublicKey = PublicKey<<<Base as Cal>::DhProvider as DhProvider>::PublicKey>
Source§fn generate_visible(&mut self, alg: Self::Algorithm) -> Self::VisibleSecretKey
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>
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>
fn import_secretkey_bytes( &mut self, alg: Self::Algorithm, secret: &[u8], ) -> Result<Self::VisibleSecretKey, ImportError>
Inverse operation of
.export_secretkey_bytes().Derives a shared secret from a public and a private key. Read more
Source§fn public_key(&mut self, private: &Self::SecretKey) -> Self::PublicKey
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>
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 moreSource§fn export_publickey_bytes<'p>(
&mut self,
public: &'p Self::PublicKey,
) -> impl AsRef<[u8]> + use<'p, Base>
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>
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§impl<Base: Cal + Ec> Ec for RustcryptoCalExtender<Base>
impl<Base: Cal + Ec> Ec for RustcryptoCalExtender<Base>
Source§const MAX_SCALAR_LENGTH: usize = Base::MAX_SCALAR_LENGTH
const MAX_SCALAR_LENGTH: usize = Base::MAX_SCALAR_LENGTH
The longest slice length ever usable with scalar import / export from any of the
primitives.
type PrimitivesP256 = <Base as Ec>::PrimitivesP256
type PrimitivesX25519 = <Base as Ec>::PrimitivesX25519
type PrimitivesX448 = <Base as Ec>::PrimitivesX448
fn p256(&mut self) -> &mut Self::PrimitivesP256
fn x25519(&mut self) -> &mut Self::PrimitivesX25519
fn x448(&mut self) -> &mut Self::PrimitivesX448
impl<Base: Cal + Hash> Hash for RustcryptoCalExtender<Base>
Source§impl<Base: Cal> HashProvider for RustcryptoCalExtender<Base>
impl<Base: Cal> HashProvider for RustcryptoCalExtender<Base>
type Algorithm = HashAlgorithm<<<Base as Cal>::HashProvider as HashProvider>::Algorithm>
Source§type State = HashState<<<Base as Cal>::HashProvider as HashProvider>::State>
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>
type Output = HashResult<<<Base as Cal>::HashProvider as HashProvider>::Output>
Output of a hashing operation. Read more
fn init(&mut self, algorithm: Self::Algorithm) -> Self::State
fn update(&mut self, instance: &mut Self::State, data: &[u8])
fn finalize(&mut self, instance: Self::State) -> Self::Output
Source§impl<Base: Cal> HmacProvider for RustcryptoCalExtender<Base>
impl<Base: Cal> HmacProvider for RustcryptoCalExtender<Base>
type Algorithm = HmacAlgorithm<<<Base as Cal>::HmacProvider as HmacProvider>::Algorithm>
Source§type Key = HmacKey<<<Base as Cal>::HmacProvider as HmacProvider>::Key>
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>
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>
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
fn load_from_keydata( &mut self, algorithm: Self::Algorithm, key: &[u8], ) -> Self::Key
Initializes a key from raw bytes.
fn update(&mut self, state: &mut Self::State, data: &[u8])
fn finalize(&mut self, state: Self::State) -> Self::Output
impl<Base: Cal + Plumbing> Plumbing for RustcryptoCalExtender<Base>
Source§impl<Base: Cal + Sha2Short> Sha2Short for RustcryptoCalExtender<Base>
impl<Base: Cal + Sha2Short> Sha2Short for RustcryptoCalExtender<Base>
Source§const SUPPORTED: bool = Base::SUPPORTED
const SUPPORTED: bool = Base::SUPPORTED
Whether this trait is actually supported. See
Plumbing docs for
rationale..Source§const SEND_PADDING: bool = Base::SEND_PADDING
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
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 moreSource§const UPDATE_MULTICHUNK: bool = Base::UPDATE_MULTICHUNK
const UPDATE_MULTICHUNK: bool = Base::UPDATE_MULTICHUNK
If true, the
Self::update() function can be passed data from consecutive blocks.Source§fn init(&mut self, variant: Sha2ShortVariant) -> Self::State
fn init(&mut self, variant: Sha2ShortVariant) -> Self::State
Initiates a
Self::State according to the selected algorithm.Source§impl<Base: Cal + TryCryptoRng> TryCryptoRng for RustcryptoCalExtender<Base>
An implementation based on getrandom.
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.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<R> CryptoRng for R
Source§impl<H> HkdfProvider for Hwhere
H: HmacProvider,
impl<H> HkdfProvider for Hwhere
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>
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
impl<R> RngCore for Rwhere
R: Rng,
Source§impl<R> RngExt for R
impl<R> RngExt for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Return a random value via the
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T> ⓘ
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T> ⓘ
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
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,
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