[−][src]Struct aes_siv::siv::Siv
Synthetic Initialization Vector (SIV) mode, providing misuse-resistant authenticated encryption (MRAE).
Methods
impl<C, M> Siv<C, M> where
C: NewStreamCipher<NonceSize = U16> + SyncStreamCipher,
M: Mac<OutputSize = U16>,
<C as NewStreamCipher>::KeySize: Add,
KeySize<C>: ArrayLength<u8>,
[src]
C: NewStreamCipher<NonceSize = U16> + SyncStreamCipher,
M: Mac<OutputSize = U16>,
<C as NewStreamCipher>::KeySize: Add,
KeySize<C>: ArrayLength<u8>,
impl<C, M> Siv<C, M> where
C: NewStreamCipher<NonceSize = U16> + SyncStreamCipher,
M: Mac<OutputSize = U16>,
[src]
C: NewStreamCipher<NonceSize = U16> + SyncStreamCipher,
M: Mac<OutputSize = U16>,
pub fn encrypt<I, T>(
&mut self,
headers: I,
plaintext: &[u8]
) -> Result<Vec<u8>, Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
[src]
&mut self,
headers: I,
plaintext: &[u8]
) -> Result<Vec<u8>, Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
Encrypt the given plaintext, allocating and returning a Vec<u8>
for
the ciphertext.
Errors
Returns Error
if plaintext.len()
is less than M::OutputSize
.
Returns Error
if headers.len()
is greater than MAX_ASSOCIATED_DATA
.
pub fn encrypt_in_place<I, T>(
&mut self,
headers: I,
buffer: &mut impl Buffer
) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
[src]
&mut self,
headers: I,
buffer: &mut impl Buffer
) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
Encrypt the given buffer containing a plaintext message in-place.
Errors
Returns Error
if plaintext.len()
is less than M::OutputSize
.
Returns Error
if headers.len()
is greater than MAX_ASSOCIATED_DATA
.
pub fn encrypt_in_place_detached<I, T>(
&mut self,
headers: I,
plaintext: &mut [u8]
) -> Result<Tag, Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
[src]
&mut self,
headers: I,
plaintext: &mut [u8]
) -> Result<Tag, Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
Encrypt the given plaintext in-place, returning the SIV tag on success.
Errors
Returns Error
if plaintext.len()
is less than M::OutputSize
.
Returns Error
if headers.len()
is greater than MAX_ASSOCIATED_DATA
.
pub fn decrypt<I, T>(
&mut self,
headers: I,
ciphertext: &[u8]
) -> Result<Vec<u8>, Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
[src]
&mut self,
headers: I,
ciphertext: &[u8]
) -> Result<Vec<u8>, Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
Decrypt the given ciphertext, allocating and returning a Vec
pub fn decrypt_in_place<I, T>(
&mut self,
headers: I,
buffer: &mut impl Buffer
) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
[src]
&mut self,
headers: I,
buffer: &mut impl Buffer
) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
Decrypt the message in-place, returning an error in the event the provided authentication tag does not match the given ciphertext.
The buffer will be truncated to the length of the original plaintext message upon success.
pub fn decrypt_in_place_detached<I, T>(
&mut self,
headers: I,
ciphertext: &mut [u8],
siv_tag: &Tag
) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
[src]
&mut self,
headers: I,
ciphertext: &mut [u8],
siv_tag: &Tag
) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: AsRef<[u8]>,
Decrypt the given ciphertext in-place, authenticating it against the provided SIV tag.
Errors
Returns Error
if the ciphertext is not authentic
Trait Implementations
impl<C, M> Drop for Siv<C, M> where
C: NewStreamCipher<NonceSize = U16> + SyncStreamCipher,
M: Mac<OutputSize = U16>,
[src]
C: NewStreamCipher<NonceSize = U16> + SyncStreamCipher,
M: Mac<OutputSize = U16>,
Auto Trait Implementations
impl<C, M> Unpin for Siv<C, M> where
M: Unpin,
<<C as NewStreamCipher>::KeySize as ArrayLength<u8>>::ArrayType: Unpin,
M: Unpin,
<<C as NewStreamCipher>::KeySize as ArrayLength<u8>>::ArrayType: Unpin,
impl<C, M> Send for Siv<C, M> where
M: Send,
<C as NewStreamCipher>::KeySize: ArrayLength<u8>,
M: Send,
<C as NewStreamCipher>::KeySize: ArrayLength<u8>,
impl<C, M> Sync for Siv<C, M> where
M: Sync,
<C as NewStreamCipher>::KeySize: ArrayLength<u8>,
M: Sync,
<C as NewStreamCipher>::KeySize: ArrayLength<u8>,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self