Skip to main content

import_key_raw

Function import_key_raw 

Source
pub async fn import_key_raw(
    variant: AesVariant,
    raw: Vec<u8>,
    options: AeadKeyOptions,
) -> Result<AeadKey, Error>
Expand description

Import raw key material as the declared AES variant.

variant is deliberately redundant with raw’s length: material of any other length fails with error.invalid-key, so malformed material (for example, key bytes accidentally left hex-encoded) cannot silently mint a key of an unintended size. An implementation not serving the variant (AES-192 is declined everywhere — see the aes-variant doc) fails with error.unsupported.