Skip to main content

Dwp

Struct Dwp 

Source
pub struct Dwp<C, TagSize>
where C: BlockCipherEncrypt + BlockSizeUser<BlockSize = U16>, TagSize: ArraySize + NonZero + IsLessOrEqual<U16, Output = True>,
{ /* private fields */ }
Expand description

belt-dwp authenticated encryption with associated data (AEAD) cipher defined in STB 34.101.31-2020 generic over block cipher implementation and tag size.

Trait Implementations§

Source§

impl<C, TagSize> AeadCore for Dwp<C, TagSize>
where C: BlockCipherEncrypt + BlockSizeUser<BlockSize = U16>, TagSize: ArraySize + NonZero + IsLessOrEqual<U16, Output = True>,

Source§

const TAG_POSITION: TagPosition = TagPosition::Postfix

The AEAD tag position.
Source§

type NonceSize = <C as BlockSizeUser>::BlockSize

The length of a nonce.
Source§

type TagSize = TagSize

The maximum length of the tag.
Source§

impl<C, TagSize> AeadInOut for Dwp<C, TagSize>
where C: BlockCipherEncrypt + BlockSizeUser<BlockSize = U16>, TagSize: ArraySize + NonZero + IsLessOrEqual<U16, Output = True>,

Source§

fn encrypt_inout_detached( &self, nonce: &Nonce, associated_data: &[u8], buffer: InOutBuf<'_, '_, u8>, ) -> Result<Tag<Self>>

Encrypt the data in the provided InOutBuf, returning the authentication tag. Read more
Source§

fn decrypt_inout_detached( &self, nonce: &Nonce, associated_data: &[u8], buffer: InOutBuf<'_, '_, u8>, tag: &Tag<Self>, ) -> Result<()>

Decrypt the data in the provided InOutBuf, returning an error in the event the provided authentication tag is invalid for the given ciphertext (i.e. ciphertext is modified/unauthentic). Read more
Source§

fn encrypt_in_place( &self, nonce: &Array<u8, Self::NonceSize>, associated_data: &[u8], buffer: &mut dyn Buffer, ) -> Result<(), Error>

Encrypt the given buffer containing a plaintext message in-place. Read more
Source§

fn decrypt_in_place( &self, nonce: &Array<u8, Self::NonceSize>, associated_data: &[u8], buffer: &mut dyn Buffer, ) -> Result<(), Error>

Decrypt the message in-place, returning an error in the event the provided authentication tag does not match the given ciphertext. Read more
Source§

impl<C, TagSize> Debug for Dwp<C, TagSize>
where C: BlockCipherEncrypt + BlockSizeUser<BlockSize = U16>, TagSize: ArraySize + NonZero + IsLessOrEqual<U16, Output = True>,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<C, TagSize> InnerInit for Dwp<C, TagSize>
where C: BlockCipherEncrypt + BlockSizeUser<BlockSize = U16>, TagSize: ArraySize + NonZero + IsLessOrEqual<U16, Output = True>,

Source§

fn inner_init(cipher: Self::Inner) -> Self

Initialize value from the inner.
Source§

impl<C, TagSize> InnerUser for Dwp<C, TagSize>
where C: BlockCipherEncrypt + BlockSizeUser<BlockSize = U16>, TagSize: ArraySize + NonZero + IsLessOrEqual<U16, Output = True>,

Source§

type Inner = C

Inner type.
Source§

impl<C, TagSize> ZeroizeOnDrop for Dwp<C, TagSize>
where C: ZeroizeOnDrop + BlockCipherEncrypt + BlockSizeUser<BlockSize = U16>, TagSize: ArraySize + NonZero + IsLessOrEqual<U16, Output = True>,

Available on crate feature zeroize only.

Auto Trait Implementations§

§

impl<C, TagSize> Freeze for Dwp<C, TagSize>
where C: Freeze,

§

impl<C, TagSize> RefUnwindSafe for Dwp<C, TagSize>
where C: RefUnwindSafe, TagSize: RefUnwindSafe,

§

impl<C, TagSize> Send for Dwp<C, TagSize>
where C: Send, TagSize: Send,

§

impl<C, TagSize> Sync for Dwp<C, TagSize>
where C: Sync, TagSize: Sync,

§

impl<C, TagSize> Unpin for Dwp<C, TagSize>
where C: Unpin, TagSize: Unpin,

§

impl<C, TagSize> UnsafeUnpin for Dwp<C, TagSize>
where C: UnsafeUnpin,

§

impl<C, TagSize> UnwindSafe for Dwp<C, TagSize>
where C: UnwindSafe, TagSize: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Aead for T
where T: AeadInOut,

Source§

fn encrypt<'msg, 'aad>( &self, nonce: &Array<u8, <T as AeadCore>::NonceSize>, plaintext: impl Into<Payload<'msg, 'aad>>, ) -> Result<Vec<u8>, Error>

Encrypt the given plaintext payload, and return the resulting ciphertext as a vector of bytes. Read more
Source§

fn decrypt<'msg, 'aad>( &self, nonce: &Array<u8, <T as AeadCore>::NonceSize>, ciphertext: impl Into<Payload<'msg, 'aad>>, ) -> Result<Vec<u8>, Error>

Decrypt the given ciphertext slice, and return the resulting plaintext as a vector of bytes. Read more
Source§

impl<T> AeadInPlace for T
where T: AeadInOut,

Source§

fn encrypt_in_place( &self, nonce: &Array<u8, <T as AeadCore>::NonceSize>, associated_data: &[u8], buffer: &mut dyn Buffer, ) -> Result<(), Error>

👎Deprecated since 0.6.0:

use AeadInOut::encrypt_in_place instead

Encrypt the given buffer containing a plaintext message in-place.
Source§

fn encrypt_in_place_detached( &self, nonce: &Array<u8, <T as AeadCore>::NonceSize>, associated_data: &[u8], buffer: &mut [u8], ) -> Result<Array<u8, <T as AeadCore>::TagSize>, Error>

👎Deprecated since 0.6.0:

use AeadInOut::encrypt_inout_detached instead

Encrypt the data in-place, returning the authentication tag
Source§

fn decrypt_in_place( &self, nonce: &Array<u8, <T as AeadCore>::NonceSize>, associated_data: &[u8], buffer: &mut dyn Buffer, ) -> Result<(), Error>

👎Deprecated since 0.6.0:

use AeadInOut::decrypt_in_place instead

Decrypt the message in-place, returning an error in the event the provided authentication tag does not match the given ciphertext.
Source§

fn decrypt_in_place_detached( &self, nonce: &Array<u8, <T as AeadCore>::NonceSize>, associated_data: &[u8], buffer: &mut [u8], tag: &Array<u8, <T as AeadCore>::TagSize>, ) -> Result<(), Error>

👎Deprecated since 0.6.0:

use AeadInOut::decrypt_inout_detached instead

Decrypt the message in-place, returning an error in the event the provided authentication tag does not match the given ciphertext (i.e. ciphertext is modified/unauthentic)
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> KeyInit for T
where T: InnerInit, <T as InnerUser>::Inner: KeyInit,

Source§

fn new(key: &Array<u8, <T as KeySizeUser>::KeySize>) -> T

Create new value from fixed size key.
Source§

fn new_from_slice(key: &[u8]) -> Result<T, InvalidLength>

Create new value from variable size key. Read more
Source§

fn generate_key<R>(rng: &mut R) -> Array<u8, Self::KeySize>
where R: CryptoRng,

👎Deprecated since 0.2.0:

use the Generate trait impl on Key instead

Available on crate feature rand_core only.
DEPRECATED: generate random key using the provided CryptoRng. Read more
Source§

impl<T> KeySizeUser for T
where T: InnerUser, <T as InnerUser>::Inner: KeySizeUser,

Source§

type KeySize = <<T as InnerUser>::Inner as KeySizeUser>::KeySize

Key size in bytes.
Source§

fn key_size() -> usize

Return key size in bytes.
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.