Documentation
¶
Index ¶
Constants ¶
const ( // No flags specified. CustomKeyInformationFlags_None uint8 = 0 // Reserved for future use. (CUSTOMKEYINFO_FLAGS_ATTESTATION) CustomKeyInformationFlags_Attestation uint8 = 0x01 // During creation of this key, the requesting client authenticated using // only a single credential. (CUSTOMKEYINFO_FLAGS_MFA_NOT_USED) CustomKeyInformationFlags_MFANotUsed uint8 = 0x02 )
const ( // Volume not specified. CustomKeyInformationVolumeType_None uint8 = 0x00 // Operating system volume (OSV). CustomKeyInformationVolumeType_OperatingSystem uint8 = 0x01 // Fixed data volume (FDV). CustomKeyInformationVolumeType_Fixed uint8 = 0x02 // Removable data volume (RDV). CustomKeyInformationVolumeType_Removable uint8 = 0x03 )
const ( // A SHA256 hash of the Value field of the KeyMaterial entry. KeyCredentialEntryType_KeyID uint8 = 0x01 // A SHA256 hash of all entries following this entry. KeyCredentialEntryType_KeyHash uint8 = 0x02 // Key material of the credential. KeyCredentialEntryType_KeyMaterial uint8 = 0x03 // Key Usage KeyCredentialEntryType_KeyUsage uint8 = 0x04 // Key Source KeyCredentialEntryType_KeySource uint8 = 0x05 // Device Identifier KeyCredentialEntryType_DeviceId uint8 = 0x06 // Custom key information. KeyCredentialEntryType_CustomKeyInformation uint8 = 0x07 // The approximate time this key was last used, in FILETIME format. KeyCredentialEntryType_KeyApproximateLastLogonTimeStamp uint8 = 0x08 // The approximate time this key was created, in FILETIME format. KeyCredentialEntryType_KeyCreationTime uint8 = 0x09 )
const ( KeyCredentialVersion_0 uint32 = 0x0 KeyCredentialVersion_1 uint32 = 0x00000100 KeyCredentialVersion_2 uint32 = 0x00000200 )
const ( // Key strength is unknown. KeyStrength_Unknown uint32 = 0x00 // Key strength is weak. KeyStrength_Weak uint32 = 0x01 // Key strength is normal. KeyStrength_Normal uint32 = 0x02 )
const ( // Admin key (pin-reset key) KeyUsage_AdminKey uint8 = 0 // NGC key attached to a user object (KEY_USAGE_NGC) KeyUsage_NGC uint8 = 0x01 // Transport key attached to a device object KeyUsage_STK uint8 = 0x02 // BitLocker recovery key KeyUsage_BitlockerRecovery uint8 = 0x03 // Unrecognized key usage KeyUsage_Other uint8 = 0x04 // Fast IDentity Online Key (KEY_USAGE_FIDO) KeyUsage_FIDO uint8 = 0x07 // File Encryption Key (KEY_USAGE_FEK) KeyUsage_FEK uint8 = 0x08 // DPAPI Key // TODO: The DPAPI enum needs to be mapped to a proper integer value. KeyUsage_DPAPI uint8 = 0x09 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomKeyInformation ¶
type CustomKeyInformation struct {
Version int
Flags CustomKeyInformationFlags
CurrentVersion int
ShortRepresentationSize int
ReservedSize int
VolumeType CustomKeyInformationVolumeType
SupportsNotification bool
FekKeyVersion uint8
Strength KeyStrength
Reserved []byte
EncodedExtendedCKI []byte
// Internal
RawBytes []byte
RawBytesSize uint32
}
CustomKeyInformation represents the CUSTOM_KEY_INFORMATION structure.
func (*CustomKeyInformation) Describe ¶
func (cki *CustomKeyInformation) Describe(indent int)
Describe prints a detailed description of the CustomKeyInformation instance.
Parameters: - indent: An integer representing the indentation level for the printed output.
Note: This function prints the Flags, VolumeType, SupportsNotification, FekKeyVersion, Strength, Reserved, and EncodedExtendedCKI values of the CustomKeyInformation instance. The output is formatted with the specified indentation level to improve readability.
func (*CustomKeyInformation) FromBytes ¶
func (cki *CustomKeyInformation) FromBytes(blob []byte, version KeyCredentialVersion) error
Parse parses the provided byte slice into the CustomKeyInformation structure.
Parameters: - blob: A byte slice containing the raw custom key information to be parsed.
Returns: - An error if the parsing fails, otherwise nil.
Note: The function expects the byte slice to follow the CUSTOM_KEY_INFORMATION structure format. It extracts the version, flags, volume type, supports notification, FEK key version, strength, reserved, and encoded extended CKI fields from the byte slice. The parsed values are stored in the CustomKeyInformation structure.
func (*CustomKeyInformation) ToBytes ¶
func (cki *CustomKeyInformation) ToBytes() []byte
ToBytes returns the raw bytes of the CustomKeyInformation structure.
type CustomKeyInformationFlags ¶
type CustomKeyInformationFlags struct {
Value uint8
Name []string
// Internal
RawBytes []byte
RawBytesSize uint32
}
CustomKeyInformationFlags represents custom key flags.
See: https://msdn.microsoft.com/en-us/library/mt220496.aspx
func (*CustomKeyInformationFlags) FromBytes ¶
func (kf *CustomKeyInformationFlags) FromBytes(value byte)
Parse parses the provided byte slice into the CustomKeyInformationFlags structure.
Parameters: - value: A byte slice containing the raw key flags to be parsed.
Note: The function expects the byte slice to contain a single byte representing the key flags. It extracts the flags value from the byte slice and assigns it to the CustomKeyInformationFlags structure.
type CustomKeyInformationVolumeType ¶
type CustomKeyInformationVolumeType struct {
Value uint8
// Internal
RawBytes []byte
RawBytesSize uint32
}
CustomKeyInformationVolumeType represents the volume type.
See: https://msdn.microsoft.com/en-us/library/mt220496.aspx
func (*CustomKeyInformationVolumeType) Describe ¶
func (vt *CustomKeyInformationVolumeType) Describe(indent int)
Describe prints a detailed description of the CustomKeyInformationVolumeType instance.
Parameters: - indent: An integer representing the indentation level for the printed output.
Note: This function prints the Value and Name of the CustomKeyInformationVolumeType instance. The output is formatted with the specified indentation level to improve readability.
func (*CustomKeyInformationVolumeType) FromBytes ¶
func (vt *CustomKeyInformationVolumeType) FromBytes(value byte)
Parse parses the provided byte slice into the CustomKeyInformationVolumeType structure.
Parameters: - value: A byte slice containing the raw volume type to be parsed.
Note: The function expects the byte slice to contain a single byte representing the volume type. It extracts the volume type value from the byte slice and assigns it to the CustomKeyInformationVolumeType structure.
func (*CustomKeyInformationVolumeType) String ¶
func (vt *CustomKeyInformationVolumeType) String() string
String returns a string representation of the CustomKeyInformationVolumeType.
Returns: - A string representing the CustomKeyInformationVolumeType.
type KeyCredentialEntryType ¶
Key Credential Link Entry Identifier
Describes the data stored in the Value field. https://msdn.microsoft.com/en-us/library/mt220499.aspx
func (*KeyCredentialEntryType) FromBytes ¶
func (k *KeyCredentialEntryType) FromBytes(value byte)
func (*KeyCredentialEntryType) String ¶
func (k *KeyCredentialEntryType) String() string
String returns a string representation of the KeyCredentialEntryType.
Returns: - A string representing the KeyCredentialEntryType.
func (*KeyCredentialEntryType) ToBytes ¶
func (k *KeyCredentialEntryType) ToBytes() []byte
ToBytes returns the raw bytes of the KeyCredentialEntryType structure.
Returns: - A byte slice representing the raw bytes of the KeyCredentialEntryType structure.
type KeyCredentialVersion ¶
func (*KeyCredentialVersion) FromBytes ¶
func (kcv *KeyCredentialVersion) FromBytes(value []byte)
Parse parses the KeyCredentialVersion from a byte array.
Parameters: - value: A byte array representing the KeyCredentialVersion.
func (*KeyCredentialVersion) String ¶
func (kcv *KeyCredentialVersion) String() string
String returns a string representation of the KeyCredentialVersion.
Returns: - A string representing the KeyCredentialVersion.
func (*KeyCredentialVersion) ToBytes ¶
func (kcv *KeyCredentialVersion) ToBytes() []byte
ToBytes returns the raw bytes of the KeyCredentialVersion structure.
Returns: - A byte slice representing the raw bytes of the KeyCredentialVersion structure.
type KeySource ¶
type KeySource int
KeySource represents the source of the key. See: https://msdn.microsoft.com/en-us/library/mt220501.aspx
type KeyStrength ¶
type KeyStrength struct {
Name string
Value uint32
// Internal
RawBytes []byte
RawBytesSize uint32
}
KeyStrength specifies the strength of the NGC key. See: https://msdn.microsoft.com/en-us/library/mt220496.aspx
func (*KeyStrength) FromBytes ¶
func (ks *KeyStrength) FromBytes(value []byte)