pub fn derive_master_key_from_prekey(
mk: &MasterKey,
pre_key: &[u8],
) -> Result<[u8; 64], DpapiError>Expand description
Derive the 64-byte master key from a master-key sub-blob and a pre-key.
pre_key is the per-user pre-key (impacket’s deriveKeysFromUser output for
the password path, or LSA UserKey/MachineKey for the SYSTEM path). Mirrors
impacket MasterKey.decrypt: derive cryptKey || iv, CBC-decrypt, take the
trailing 64 bytes, and verify the embedded HMAC; an HMAC mismatch (wrong
pre-key) is rejected with DpapiError::HmacMismatch rather than returning
garbage.