Skip to main content

E

Struct E 

Source
pub struct E;
Expand description

The ARX-8-2-4-E variant. Has a key length of 48 bytes and a maximum input length of 64 bytes. See the ArxKW trait for usage.

Implementations§

Source§

impl E

Source

pub const fn key_length() -> usize

The length in bytes of the secret key used by this variant of ARX-KW

Source

pub const fn max_input_length() -> usize

Returns the maximum length in bytes for the input to E::encrypt and E::decrypt


This is the same for the plaintext input when encrypting and ciphertext input when decrypting, but is not the same for all variants of ARX-KW. Specifically, the E and G variants are defined only for plaintext/ciphertext inputs of no more than 512 bits, the length of a ChaCha Block, whereas EX and GX do not have this limitation.

Trait Implementations§

Source§

impl ArxKW for E

Source§

const VARIANT_ID: u8 = 1

Stable identifier stored in versioned envelopes (1=E, 2=G, 3=EX, 4=GX).
Source§

const MAX_INPUT_LENGTH: usize = 64

Maximum plaintext or ciphertext length accepted before allocation.
Source§

type Key = [u8; 48]

The type of data which is used as a key for the type that impls this trait. Note that this is not the same for all variants of ARX-KW. E and EX use 48-byte keys; G and GX use 32-byte keys
Source§

fn encrypt( key: &Self::Key, plaintext: &[u8], ) -> Result<(Vec<u8>, AuthTag), ArxKwError>

Encrypts the plaintext using ARX-KW and returns the encrypted ciphertext and an AuthTag Read more
Source§

fn decrypt( key: &Self::Key, ciphertext: &[u8], authentication_tag: &AuthTag, ) -> Result<Vec<u8>, ArxKwError>

Attempts to decrypt the ciphertext using ARX-KW and returns the decrypted plaintext if successful. As ARX-KW is a form of authenticated encryption, the authenticity of the decrypted text is verified if the function returns an Ok value. Read more
Source§

fn encrypt_envelope( key: &Self::Key, plaintext: &[u8], context: &[u8], ) -> Result<Vec<u8>, ArxKwError>

Wraps key material into a versioned envelope bound to an application context. Available with the envelope feature (enabled by default). Read more
Source§

fn decrypt_envelope( key: &Self::Key, input: &[u8], context: &[u8], ) -> Result<SecretBytes, ArxKwError>

Opens a versioned envelope into plaintext that zeroizes when dropped. Available with the envelope feature (enabled by default). Read more
Source§

fn decrypt_secret( key: &Self::Key, blob: &[u8], ) -> Result<SecretBytes, ArxKwError>

Decrypts a legacy blob into plaintext that zeroizes when dropped. Read more
Source§

fn encrypt_blob( key: &Self::Key, plaintext: &[u8], ) -> Result<Vec<u8>, ArxKwError>

Encrypts the plaintext and returns a Vec<u8> containing both the authentication tag and the ciphertext. Read more
Source§

fn decrypt_blob(key: &Self::Key, blob: &[u8]) -> Result<Vec<u8>, ArxKwError>

Decrypts a blob containing an authentication tag followed by the corresponding ciphertext Read more

Auto Trait Implementations§

§

impl Freeze for E

§

impl RefUnwindSafe for E

§

impl Send for E

§

impl Sync for E

§

impl Unpin for E

§

impl UnsafeUnpin for E

§

impl UnwindSafe for E

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.