Struct mbedtls::cipher::Cipher

source ·
pub struct Cipher<O: Operation, T: Type, S: State = Fresh> { /* private fields */ }

Implementations§

source§

impl<O: Operation, T: Type, S: State> Cipher<O, T, S>

source

pub fn block_size(&self) -> usize

source

pub fn iv_size(&self) -> usize

source

pub fn tag_size(&self) -> Option<Range<usize>>

source

pub fn cipher_mode(&self) -> CipherMode

source§

impl<O: Operation, T: Type> Cipher<O, T, Fresh>

source

pub fn new( cipher_id: CipherId, cipher_mode: CipherMode, key_bit_len: u32 ) -> Result<Cipher<O, T, Fresh>>

source

pub fn set_parity(key: &mut [u8]) -> Result<()>

source§

impl<Op: Operation, T: Type> Cipher<Op, T, Fresh>

source

pub fn set_padding(&mut self, padding: CipherPadding) -> Result<()>

source§

impl<O: Operation> Cipher<O, TraditionalNoIv, Fresh>

source

pub fn set_key(self, key: &[u8]) -> Result<Cipher<O, Traditional, CipherData>>

source§

impl<O: Operation> Cipher<O, Traditional, Fresh>

source

pub fn set_key_iv( self, key: &[u8], iv: &[u8] ) -> Result<Cipher<O, Traditional, CipherData>>

source§

impl<O: Operation> Cipher<O, Authenticated, Fresh>

source

pub fn set_key_iv( self, key: &[u8], iv: &[u8] ) -> Result<Cipher<O, Authenticated, AdditionalData>>

source§

impl<O: Operation> Cipher<O, Authenticated, AdditionalData>

source

pub fn set_ad(self, ad: &[u8]) -> Result<Cipher<O, Authenticated, CipherData>>

source§

impl Cipher<Encryption, Traditional, CipherData>

source

pub fn encrypt( self, plain_text: &[u8], cipher_text: &mut [u8] ) -> Result<(usize, Cipher<Encryption, Traditional, Finished>)>

source§

impl Cipher<Decryption, Traditional, CipherData>

source

pub fn decrypt( self, cipher_text: &[u8], plain_text: &mut [u8] ) -> Result<(usize, Cipher<Decryption, Traditional, Finished>)>

source§

impl Cipher<Encryption, TraditionalNoIv, Fresh>

source

pub fn cmac( self, key: &[u8], in_data: &[u8], out_data: &mut [u8] ) -> Result<Cipher<Encryption, TraditionalNoIv, Finished>>

source§

impl Cipher<Encryption, Authenticated, AdditionalData>

source

pub fn encrypt_auth( self, ad: &[u8], plain_text: &[u8], cipher_and_tag: &mut [u8], tag_len: usize ) -> Result<(usize, Cipher<Encryption, Authenticated, Finished>)>

source

pub fn encrypt_auth_inplace( self, ad: &[u8], data: &mut [u8], tag: &mut [u8] ) -> Result<(usize, Cipher<Encryption, Authenticated, Finished>)>

source§

impl Cipher<Decryption, Authenticated, AdditionalData>

source

pub fn decrypt_auth( self, ad: &[u8], cipher_text_and_tag: &[u8], plain_text: &mut [u8], tag_len: usize ) -> Result<(usize, Cipher<Decryption, Authenticated, Finished>)>

source

pub fn decrypt_auth_inplace( self, ad: &[u8], data: &mut [u8], tag: &[u8] ) -> Result<(usize, Cipher<Decryption, Authenticated, Finished>)>

source§

impl<O: Operation, T: Type> Cipher<O, T, CipherData>

source

pub fn update( self, in_data: &[u8], out_data: &mut [u8] ) -> Result<(usize, Cipher<O, T, CipherData>)>

source

pub fn finish( self, out_data: &mut [u8] ) -> Result<(usize, Cipher<O, T, Finished>)>

source§

impl<O: Operation> Cipher<O, Authenticated, Finished>

source

pub fn write_tag( self, out_tag: &mut [u8] ) -> Result<Cipher<O, Authenticated, Finished>>

source

pub fn check_tag(self, tag: &[u8]) -> Result<Cipher<O, Authenticated, Finished>>

Trait Implementations§

source§

impl<'de, Op: Operation, T: Type> Deserialize<'de> for Cipher<Op, T, CipherData>

source§

fn deserialize<D>(d: D) -> Result<Cipher<Op, T, CipherData>, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<Op: Operation, T: Type> Serialize for Cipher<Op, T, CipherData>

source§

fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<O, T, S> RefUnwindSafe for Cipher<O, T, S>

§

impl<O, T, S> Send for Cipher<O, T, S>
where O: Send, S: Send, T: Send,

§

impl<O, T, S = Fresh> !Sync for Cipher<O, T, S>

§

impl<O, T, S> Unpin for Cipher<O, T, S>
where O: Unpin, S: Unpin, T: Unpin,

§

impl<O, T, S> UnwindSafe for Cipher<O, T, S>
where O: UnwindSafe, S: UnwindSafe, T: 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,