Crypto

Struct Crypto 

Source
pub struct Crypto<Rng: RngCore + CryptoRng> { /* private fields */ }
Expand description

A type representing cryptographic operations through various RustCrypto crates (eg. aes, ccm, p256).

Its size depends on the implementation of Rng passed in at creation.

Implementations§

Source§

impl<Rng: RngCore + CryptoRng> Crypto<Rng>

Source

pub const fn new(rng: Rng) -> Self

Trait Implementations§

Source§

impl<Rng: RngCore + CryptoRng> Crypto for Crypto<Rng>

Source§

fn sha256_digest( &mut self, message: &BytesMaxBuffer, message_len: usize, ) -> BytesHashLen

Source§

fn hkdf_expand( &mut self, prk: &BytesHashLen, info: &BytesMaxInfoBuffer, info_len: usize, length: usize, ) -> BytesMaxBuffer

Source§

fn hkdf_extract( &mut self, salt: &BytesHashLen, ikm: &BytesP256ElemLen, ) -> BytesHashLen

Source§

fn aes_ccm_encrypt_tag_8( &mut self, key: &BytesCcmKeyLen, iv: &BytesCcmIvLen, ad: &[u8], plaintext: &BufferPlaintext3, ) -> BufferCiphertext3

Source§

fn aes_ccm_decrypt_tag_8( &mut self, key: &BytesCcmKeyLen, iv: &BytesCcmIvLen, ad: &[u8], ciphertext: &BufferCiphertext3, ) -> Result<BufferPlaintext3, EDHOCError>

Source§

fn p256_ecdh( &mut self, private_key: &BytesP256ElemLen, public_key: &BytesP256ElemLen, ) -> BytesP256ElemLen

Source§

fn get_random_byte(&mut self) -> u8

Source§

fn p256_generate_key_pair(&mut self) -> (BytesP256ElemLen, BytesP256ElemLen)

Source§

fn supported_suites( &self, ) -> EdhocBuffer<lakers_shared::::crypto::Crypto::supported_suites::{constant#1}>

Returns the list of cryptographic suites supported by the backend implementation.
Source§

impl<Rng: RngCore + CryptoRng> Debug for Crypto<Rng>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Rng> Freeze for Crypto<Rng>
where Rng: Freeze,

§

impl<Rng> RefUnwindSafe for Crypto<Rng>
where Rng: RefUnwindSafe,

§

impl<Rng> Send for Crypto<Rng>
where Rng: Send,

§

impl<Rng> Sync for Crypto<Rng>
where Rng: Sync,

§

impl<Rng> Unpin for Crypto<Rng>
where Rng: Unpin,

§

impl<Rng> UnwindSafe for Crypto<Rng>
where Rng: 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<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> 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 = 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.