Skip to main content

MasterKeyFile

Struct MasterKeyFile 

Source
pub struct MasterKeyFile {
    pub guid: String,
    pub master_key: Option<MasterKey>,
}
Expand description

The parsed masterkey-file header plus the embedded encrypted masterkey.

Fields§

§guid: String

The {guid} this file is named after (identifies which key a blob needs).

§master_key: Option<MasterKey>

The encrypted masterkey subfield, if present (MasterKeyLen > 0).

Implementations§

Source§

impl MasterKeyFile

Source

pub fn parse(data: &[u8]) -> Result<Self, DpapiError>

Parse the 128-byte header + subfields. Only the MasterKey subfield is decoded; BackupKey/CredHist/DomainKey are skipped.

Header layout (verified byte-for-byte against real Windows Server 2025 masterkey files at C:\Users\<u>\AppData\Roaming\Microsoft\Protect\<SID>\<GUID>):

  0..4    Version   (u32 = 2 on modern Windows)
  4..8    Unk1
  8..12   Unk2
 12..84   Guid      (72 bytes UTF-16LE, the file's own {guid} name)
 84..88   Unk3
 88..92   Policy
 92..96   Flags     (u32 — impacket had this as u64 in older versions; MODERN is u32)
 96..104  MasterKeyLen  (u64)
104..112  BackupKeyLen  (u64)
112..120  CredHistLen   (u64)
120..128  DomainKeyLen  (u64)
128..     [ MasterKey ][ BackupKey ][ CredHist ][ DomainKey ]  concatenated

Trait Implementations§

Source§

impl Clone for MasterKeyFile

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MasterKeyFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.