Skip to main content

import_key_raw

Function import_key_raw 

Source
pub async fn import_key_raw(
    variant: Sha2Variant,
    raw: Vec<u8>,
    options: MacKeyOptions,
) -> Result<MacKey, Error>
Expand description

Import raw key material as an HMAC key over the declared SHA-2 variant.

Empty keys fail error.invalid-key. Implementations generally accept any non-empty length (per RFC 2104; keys longer than the block size are hashed first), but an implementation enforcing a security policy (for example FIPS 140-3 approved mode, which requires keys of at least 112 bits) MAY reject shorter keys with error.invalid-key. An implementation not serving the variant fails with error.unsupported.