Skip to main content

GX

Struct GX 

Source
pub struct GX;
Expand description

The ARX-8-2-4-GX variant. Has a key length of 32 bytes and a maximum input length of one MiB. See the ArxKW trait for usage.

Implementations§

Source§

impl GX

Source

pub const fn key_length() -> usize

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

Trait Implementations§

Source§

impl ArxKW for GX

Source§

const VARIANT_ID: u8 = 4

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

type Key = [u8; 32]

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§

const MAX_INPUT_LENGTH: usize = MAX_INPUT_LENGTH

Maximum plaintext or ciphertext length accepted before allocation.
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 GX

§

impl RefUnwindSafe for GX

§

impl Send for GX

§

impl Sync for GX

§

impl Unpin for GX

§

impl UnsafeUnpin for GX

§

impl UnwindSafe for GX

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.