masterkey

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupKey

type BackupKey MasterKey

func (*BackupKey) DecryptWithHash

func (backupKey *BackupKey) DecryptWithHash(userSID string, pwdHash []byte)

DecryptWithHash Decrypts the backupKey with the given user's hash and SID.

type CredHist

type CredHist struct {
	Version uint32
	Guid    [16]byte
}

type DomainKey

type DomainKey struct {
	Version         uint32
	SecretLen       uint32
	AccessCheckLen  uint32
	GuidKey         []byte
	EncryptedSecret []byte
	AccessCheck     []byte

	// Store result data
	Decrypted bool
	Key       []byte
}

type DpapiDomainRsaMasterKey

type DpapiDomainRsaMasterKey struct {
	CbMasterKey uint32
	CbSuppKey   uint32
	Buffer      []byte
}
type Header struct {
	Version      uint32
	Guid         []byte
	Policy       uint32
	MasterKeyLen uint64
	BackupKeyLen uint64
	CredHistLen  uint64
	DomainKeyLen uint64
}

type MasterKey

type MasterKey struct {
	Version  uint32
	Salt     [16]byte
	Rounds   uint32
	AlgHash  uint32
	AlgCrypt uint32
	PbKey    []byte

	// Store result data
	Decrypted    bool
	Key          []byte
	KeyHash      []byte
	HmacSalt     []byte
	Hmac         []byte
	HmacComputed []byte
}

func (*MasterKey) DecryptWithHash

func (masterKey *MasterKey) DecryptWithHash(userSID string, pwdHash []byte)

Decrypts the masterKey with the given user's hash and SID.

func (*MasterKey) DecryptWithKey

func (masterKey *MasterKey) DecryptWithKey(pwdHash []byte)
 Decrypts the masterKey with the given encryption key. This function
	also extracts the HMAC part of the decrypted stuff and compare it with
	the computed one.
	Note that, once successfully decrypted, the masterKey will not be
	decrypted anymore; this function will simply return.

type MasterKeyFile

type MasterKeyFile struct {
	Header    Header
	MasterKey MasterKey
	BackupKey BackupKey
	CredHist  CredHist
	DomainKey DomainKey
	Decrypted bool
	Guid      []byte
	Key       []byte
}

func InitMasterKeyFile

func InitMasterKeyFile(masterKeyFileData []byte) MasterKeyFile

InitMasterKeyFile Init master key file.

func (*MasterKeyFile) DecryptWithHash

func (masterKeyFile *MasterKeyFile) DecryptWithHash(userSID string, hash string)

DecryptWithHash Decrypt master key file with ntlm hash or sha1 hash.

func (*MasterKeyFile) DecryptWithPassword

func (masterKeyFile *MasterKeyFile) DecryptWithPassword(userSID, password string)

DecryptWithPassword Decrypt master key file with user password.

func (*MasterKeyFile) DecryptWithPvk

func (masterKeyFile *MasterKeyFile) DecryptWithPvk(pvkFileData []byte)

DecryptWithPvk Decrypt master key file with domain backup key.

type PrivateKeyBlob

type PrivateKeyBlob struct {
	PublicKeyStruct PublicKeyStruc
	RsaPubKey       RsaPubKey
	Modulus         []byte
	Prime1          []byte
	Prime2          []byte
	Exponent1       []byte
	Exponent2       []byte
	Coefficient     []byte
	PrivateExponent []byte
}

type PublicKeyStruc

type PublicKeyStruc struct {
	BType    byte
	BVersion byte
	Reserved uint16
	AiKeyAlg uint32
}

type PvkFile

type PvkFile struct {
	Header         PvkHeader
	PrivateKeyBlob PrivateKeyBlob
}

type PvkHeader

type PvkHeader struct {
	Magic      uint32
	Reserved   uint32
	KeyType    uint32
	Encrypted  uint32
	SaltLength uint32
	KeyLength  uint32
	Salt       []byte
}

type RsaPubKey

type RsaPubKey struct {
	Magic  uint32
	BitLen uint32
	PubExp uint32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL