pub struct G;Expand description
The ARX-8-2-4-G variant. Has a key length of 32 bytes and a maximum input length of 64 bytes.
See the ArxKW trait for usage.
Implementations§
Source§impl G
impl G
Sourcepub const fn key_length() -> usize
pub const fn key_length() -> usize
The length of the secret key used by this variant of ARX-KW, in bytes
Sourcepub const fn max_input_length() -> usize
pub const fn max_input_length() -> usize
Returns the maximum length in bytes for the input to G::encrypt and G::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 G
impl ArxKW for G
Source§const VARIANT_ID: u8 = 2
const VARIANT_ID: u8 = 2
Stable identifier stored in versioned envelopes (1=E, 2=G, 3=EX, 4=GX).
Source§const MAX_INPUT_LENGTH: usize = 64
const MAX_INPUT_LENGTH: usize = 64
Maximum plaintext or ciphertext length accepted before allocation.
Source§type Key = [u8; 32]
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 keysSource§fn decrypt(
key: &Self::Key,
ciphertext: &[u8],
authentication_tag: &AuthTag,
) -> Result<Vec<u8>, ArxKwError>
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 moreSource§fn encrypt_envelope(
key: &Self::Key,
plaintext: &[u8],
context: &[u8],
) -> Result<Vec<u8>, ArxKwError>
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 moreSource§fn decrypt_envelope(
key: &Self::Key,
input: &[u8],
context: &[u8],
) -> Result<SecretBytes, ArxKwError>
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 moreSource§fn decrypt_secret(
key: &Self::Key,
blob: &[u8],
) -> Result<SecretBytes, ArxKwError>
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>
fn encrypt_blob( key: &Self::Key, plaintext: &[u8], ) -> Result<Vec<u8>, ArxKwError>
Source§fn decrypt_blob(key: &Self::Key, blob: &[u8]) -> Result<Vec<u8>, ArxKwError>
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 G
impl RefUnwindSafe for G
impl Send for G
impl Sync for G
impl Unpin for G
impl UnsafeUnpin for G
impl UnwindSafe for G
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more