pub type KekAes128 = Kek<Aes128>;
Expand description
AES-128 KEK
Aliased Type§
struct KekAes128 {
pub(crate) cipher: Aes128,
}
Fields§
§cipher: Aes128
Initialized cipher
Implementations
Source§impl<Aes> Kek<Aes>
impl<Aes> Kek<Aes>
Sourcepub fn new(key: &GenericArray<u8, Aes::KeySize>) -> Self
pub fn new(key: &GenericArray<u8, Aes::KeySize>) -> Self
Constructs a new Kek based on the appropriate raw key material.
Sourcepub fn wrap(&self, data: &[u8], out: &mut [u8]) -> Result<()>
pub fn wrap(&self, data: &[u8], out: &mut [u8]) -> Result<()>
AES Key Wrap, as defined in RFC 3394.
The out
buffer will be overwritten, and must be exactly IV_LEN
bytes (i.e. 8 bytes) longer than the length of data
.
Sourcepub fn wrap_vec(&self, data: &[u8]) -> Result<Vec<u8>>
pub fn wrap_vec(&self, data: &[u8]) -> Result<Vec<u8>>
Computes Self::wrap
, allocating a Vec
for the return value.
Sourcepub fn unwrap(&self, data: &[u8], out: &mut [u8]) -> Result<()>
pub fn unwrap(&self, data: &[u8], out: &mut [u8]) -> Result<()>
AES Key Unwrap, as defined in RFC 3394.
The out
buffer will be overwritten, and must be exactly IV_LEN
bytes (i.e. 8 bytes) shorter than the length of data
.
Sourcepub fn unwrap_vec(&self, data: &[u8]) -> Result<Vec<u8>>
pub fn unwrap_vec(&self, data: &[u8]) -> Result<Vec<u8>>
Computes Self::unwrap
, allocating a Vec
for the return value.
Sourcepub fn wrap_with_padding(&self, data: &[u8], out: &mut [u8]) -> Result<()>
pub fn wrap_with_padding(&self, data: &[u8], out: &mut [u8]) -> Result<()>
AES Key Wrap with Padding, as defined in RFC 5649.
The out
buffer will be overwritten, and must be the smallest
multiple of SEMIBLOCK_SIZE
(i.e. 8) which is at least IV_LEN
bytes (i.e. 8 bytes) longer than the length of data
.
Sourcepub fn wrap_with_padding_vec(&self, data: &[u8]) -> Result<Vec<u8>>
pub fn wrap_with_padding_vec(&self, data: &[u8]) -> Result<Vec<u8>>
Computes Self::wrap
, allocating a Vec
for the return value.
Sourcepub fn unwrap_with_padding<'a>(
&self,
data: &[u8],
out: &'a mut [u8],
) -> Result<&'a [u8]>
pub fn unwrap_with_padding<'a>( &self, data: &[u8], out: &'a mut [u8], ) -> Result<&'a [u8]>
AES Key Wrap with Padding, as defined in RFC 5649.
The out
buffer will be overwritten, and must be exactly IV_LEN
bytes (i.e. 8 bytes) shorter than the length of data
.
This method returns a slice of out
, truncated to the appropriate
length by removing the padding.
Sourcepub fn unwrap_with_padding_vec(&self, data: &[u8]) -> Result<Vec<u8>>
pub fn unwrap_with_padding_vec(&self, data: &[u8]) -> Result<Vec<u8>>
Computes Self::unwrap
, allocating a Vec
for the return value.