aws_lc_rs::key_wrap

Type Alias AesKek

Source
pub type AesKek = KeyEncryptionKey<AesBlockCipher>;
Expand description

AES Key Encryption Key.

Aliased Type§

struct AesKek {
    cipher: &'static AesBlockCipher,
    key: Box<[u8]>,
}

Fields§

§cipher: &'static AesBlockCipher§key: Box<[u8]>

Implementations

Source§

impl<Cipher: BlockCipher> KeyEncryptionKey<Cipher>

Source

pub fn new(cipher: &'static Cipher, key: &[u8]) -> Result<Self, Unspecified>

Construct a new Key Encryption Key.

§Errors
  • Unspecified: Any error that occurs constructing the key encryption key.
Source

pub fn block_cipher_id(&self) -> BlockCipherId

Returns the block cipher algorithm identifier configured for the key.

Trait Implementations

Source§

impl<Cipher: BlockCipher> Debug for KeyEncryptionKey<Cipher>

Source§

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

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

impl KeyWrap for KeyEncryptionKey<AesBlockCipher>

Source§

fn wrap<'output>( self, plaintext: &[u8], output: &'output mut [u8], ) -> Result<&'output mut [u8], Unspecified>

Peforms the key wrap encryption algorithm using KeyEncryptionKey’s configured block cipher. It wraps plaintext and writes the corresponding ciphertext to output.

§Validation
  • plaintext.len() must be a multiple of eight
  • output.len() >= (input.len() + 8)
§Errors
  • Unspecified: An error occurred either due to output being insufficiently sized, input exceeding the allowed input size, or for other unspecified reasons.
Source§

fn unwrap<'output>( self, ciphertext: &[u8], output: &'output mut [u8], ) -> Result<&'output mut [u8], Unspecified>

Peforms the key wrap decryption algorithm using KeyEncryptionKey’s configured block cipher. It unwraps ciphertext and writes the corresponding plaintext to output.

§Validation
  • ciphertext.len() must be a multiple of 8
  • output.len() >= (input.len() - 8)
§Errors
  • Unspecified: An error occurred either due to output being insufficiently sized, input exceeding the allowed input size, or for other unspecified reasons.
Source§

impl KeyWrapPadded for KeyEncryptionKey<AesBlockCipher>

Source§

fn wrap_with_padding<'output>( self, plaintext: &[u8], output: &'output mut [u8], ) -> Result<&'output mut [u8], Unspecified>

Peforms the key wrap padding encryption algorithm using KeyEncryptionKey’s configured block cipher. It wraps and pads plaintext writes the corresponding ciphertext to output.

§Validation
  • output.len() >= (input.len() + 15)
§Errors
  • Unspecified: An error occurred either due to output being insufficiently sized, input exceeding the allowed input size, or for other unspecified reasons.
Source§

fn unwrap_with_padding<'output>( self, ciphertext: &[u8], output: &'output mut [u8], ) -> Result<&'output mut [u8], Unspecified>

Peforms the key wrap padding decryption algorithm using KeyEncryptionKey’s configured block cipher. It unwraps the padded ciphertext and writes the corresponding plaintext to output.

§Sizing output

output.len() >= input.len().

§Errors
  • Unspecified: An error occurred either due to output being insufficiently sized, input exceeding the allowed input size, or for other unspecified reasons.
Source§

impl<Cipher: BlockCipher> Sealed for KeyEncryptionKey<Cipher>