Skip to main content

parse_local_state_encrypted_key

Function parse_local_state_encrypted_key 

Source
pub fn parse_local_state_encrypted_key(
    encrypted_key_b64: &[u8],
) -> Result<Vec<u8>, DpapiError>
Expand description

Decode a Chrome/Edge Local State os_crypt.encrypted_key value into the inner DPAPI blob bytes.

encrypted_key_b64 is the raw base64 string (the JSON field value bytes). Chrome stores base64("DPAPI" + dpapi_blob), so this base64-decodes the input and strips the mandatory 5-byte DPAPI prefix, returning the DPAPI blob ready for decrypt_local_state_key.

Errors loudly — malformed base64 (DpapiError::Base64Error) or a missing DPAPI prefix (DpapiError::MissingDpapiPrefix, which names the bytes that were actually present) — rather than guessing.