openssl::aes

Function wrap_key

source
pub fn wrap_key(
    key: &AesKey,
    iv: Option<[u8; 8]>,
    out: &mut [u8],
    in_: &[u8],
) -> Result<usize, KeyError>
Expand description

Wrap a key, according to RFC 3394

  • key: The key-encrypting-key to use. Must be a encrypting key
  • iv: The IV to use. You must use the same IV for both wrapping and unwrapping
  • out: The output buffer to store the ciphertext
  • in_: The input buffer, storing the key to be wrapped

Returns the number of bytes written into out

ยงPanics

Panics if either out or in_ do not have sizes that are a multiple of 8, or if out is not 8 bytes longer than in_

This corresponds to AES_wrap_key.