Skip to main content

verify_keyed_mac

Function verify_keyed_mac 

Source
pub fn verify_keyed_mac<'a>(
    signed: &'a [u8],
    key: &[u8; 32],
) -> Result<&'a [u8], String>
Expand description

Verify a gH-trailed message: split off the trailing gH field, recompute the keyed MAC over the prefix, and constant-time compare. Returns the authenticated payload (everything before the trailer) on success. A wrong key, tampered payload, or missing trailer all fail.