customkeyinformation
import "github.com/TheManticoreProject/Manticore/windows/keycredentiallink/key/customkeyinformation"
Index
- type CUSTOMKEYINFO_FLAGS
- func NewCUSTOMKEYINFO_FLAGS(v CUSTOMKEYINFO_FLAGS) *CUSTOMKEYINFO_FLAGS
- func (kf CUSTOMKEYINFO_FLAGS) Has(mask CUSTOMKEYINFO_FLAGS) bool
- func (kf CUSTOMKEYINFO_FLAGS) Marshal() ([]byte, error)
- func (kf *CUSTOMKEYINFO_FLAGS) Set(mask CUSTOMKEYINFO_FLAGS)
- func (kf CUSTOMKEYINFO_FLAGS) String() string
- func (kf *CUSTOMKEYINFO_FLAGS) Unmarshal(data []byte) (int, error)
- type CustomKeyInformation
- type CustomKeyInformationVolumeType
- type EncodedExtendedCKI
- type FekKeyVersion
- type Reserved
- type SupportsNotification
type CUSTOMKEYINFO\_FLAGS
CUSTOMKEYINFO_FLAGS represents custom key flags.
type CUSTOMKEYINFO_FLAGS uint8
const (
// No flags specified.
CUSTOMKEYINFO_FLAGS_NONE CUSTOMKEYINFO_FLAGS = 0
// Reserved for future use. (CUSTOMKEYINFO_FLAGS_ATTESTATION)
CUSTOMKEYINFO_FLAGS_ATTESTATION CUSTOMKEYINFO_FLAGS = 0x01
// During creation of this key, the requesting client authenticated using
// only a single credential. (CUSTOMKEYINFO_FLAGS_MFA_NOT_USED)
CUSTOMKEYINFO_FLAGS_MFA_NOT_USED CUSTOMKEYINFO_FLAGS = 0x02
)
func NewCUSTOMKEYINFO\_FLAGS
func NewCUSTOMKEYINFO_FLAGS(v CUSTOMKEYINFO_FLAGS) *CUSTOMKEYINFO_FLAGS
NewCUSTOMKEYINFO_FLAGS returns a pointer to a flags value.
func (CUSTOMKEYINFO_FLAGS) Has
func (kf CUSTOMKEYINFO_FLAGS) Has(mask CUSTOMKEYINFO_FLAGS) bool
Has returns true if the provided mask is set.
func (CUSTOMKEYINFO_FLAGS) Marshal
func (kf CUSTOMKEYINFO_FLAGS) Marshal() ([]byte, error)
Marshal returns the raw bytes of the CUSTOMKEYINFO_FLAGS structure.
Returns: - A byte slice representing the raw bytes of the CUSTOMKEYINFO_FLAGS structure. - An error if the conversion fails.
func (*CUSTOMKEYINFO_FLAGS) Set
func (kf *CUSTOMKEYINFO_FLAGS) Set(mask CUSTOMKEYINFO_FLAGS)
Set sets the provided mask on the flags.
func (CUSTOMKEYINFO_FLAGS) String
func (kf CUSTOMKEYINFO_FLAGS) String() string
func (*CUSTOMKEYINFO_FLAGS) Unmarshal
func (kf *CUSTOMKEYINFO_FLAGS) Unmarshal(data []byte) (int, error)
Unmarshal parses the provided byte slice into the CUSTOMKEYINFO_FLAGS structure.
Parameters: - value: A byte slice containing the raw key flags to be parsed.
Returns: - The number of bytes read from the data. - An error if the parsing fails, otherwise nil.
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 CUSTOMKEYINFO_FLAGS structure.
type CustomKeyInformation
CustomKeyInformation represents the CUSTOM_KEY_INFORMATION structure.
Note: This structure has two possible representations. In the first representation, only the Version and Flags fields are present; in this case the structure has a total size of two bytes. In the second representation, all additional fields shown below are also present; in this case, the structure’s total size is variable. Differentiating between the two representations MUST be inferred using only the total size.
type CustomKeyInformation struct {
// Version (1 byte): An 8-bit unsigned integer that MUST be set to 1.
Version uint8
// Flags (1 byte): An 8-bit unsigned integer that specifies zero or more bit-flag values
Flags *CUSTOMKEYINFO_FLAGS
// VolType (1 byte): An 8-bit unsigned integer that specifies one of the following volume types:
VolumeType *CustomKeyInformationVolumeType
// SupportsNotification (1 byte): An 8-bit unsigned integer that specifies whether the device
// associated with this credential supports notification.
SupportsNotification *SupportsNotification
// FekKeyVersion (1 byte): An 8-bit unsigned integer that specifies the version of the buffer
// stored in KEY_USAGE_FEK (section 2.2.20.5.3). This field MUST be set to 1.
FekKeyVersion *FekKeyVersion
// KeyStrength (1 byte): An 8-bit unsigned integer that specifies the strength of the NGC key.
KeyStrength *strength.KeyStrength
// Reserved (10 bytes): Reserved for future use.
Reserved *Reserved
// EncodedExtendedCKI (variable): Extended custom key information.
// The contents of this field are defined in section 2.2.20.4.1.
// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/b2c0cb9b-e49e-4907-9235-f9fd7eee8c13
EncodedExtendedCKI *EncodedExtendedCKI
}
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) Marshal
func (cki *CustomKeyInformation) Marshal() ([]byte, error)
Marshal returns the raw bytes of the CustomKeyInformation structure.
Returns: - A byte slice representing the raw bytes of the CustomKeyInformation structure. - An error if the conversion fails.
func (*CustomKeyInformation) Unmarshal
func (cki *CustomKeyInformation) Unmarshal(data []byte, kcv version.KeyCredentialLinkVersion) (int, error)
Unmarshal parses the provided byte slice into the CustomKeyInformation structure.
Parameters: - data: A byte slice containing the raw custom key information to be parsed. - kcv: The version of the key credential link.
Returns: - The number of bytes read from the data. - 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.
type CustomKeyInformationVolumeType
CustomKeyInformationVolumeType represents the volume type.
Sources: https://msdn.microsoft.com/en-us/library/mt220496.aspx https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/701a55dc-d062-4032-a2da-dbdfc384c8cf
type CustomKeyInformationVolumeType uint8
const (
// Volume not specified.
CustomKeyInformationVolumeType_None CustomKeyInformationVolumeType = 0x00
// Operating system volume (OSV).
CustomKeyInformationVolumeType_OSV CustomKeyInformationVolumeType = 0x01
// Fixed data volume (FDV).
CustomKeyInformationVolumeType_FDV CustomKeyInformationVolumeType = 0x02
// Removable data volume (RDV).
CustomKeyInformationVolumeType_RDV CustomKeyInformationVolumeType = 0x03
)
func (CustomKeyInformationVolumeType) Marshal
func (vt CustomKeyInformationVolumeType) Marshal() ([]byte, error)
Marshal returns the raw bytes of the CustomKeyInformationVolumeType structure.
Returns: - A byte slice representing the raw bytes of the CustomKeyInformationVolumeType structure. - An error if the conversion fails.
func (CustomKeyInformationVolumeType) String
func (vt CustomKeyInformationVolumeType) String() string
String returns a string representation of the CustomKeyInformationVolumeType.
Returns: - A string representing the CustomKeyInformationVolumeType.
func (*CustomKeyInformationVolumeType) Unmarshal
func (vt *CustomKeyInformationVolumeType) Unmarshal(data []byte) (int, error)
Unmarshal parses the provided byte slice into the CustomKeyInformationVolumeType structure.
Parameters: - data: A byte slice containing the raw volume type to be parsed.
Returns: - The number of bytes read from the data. - An error if the parsing fails, otherwise nil.
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.
type EncodedExtendedCKI
EncodedExtendedCKI represents the EncodedExtendedCKI structure.
Fields: - Version (1 byte): MUST be 0. - Size (1 byte): Size in bytes of the Data field. - Data (variable): CBOR-encoded blob, length == Size.
type EncodedExtendedCKI struct {
// Version MUST be 0
Version uint8
// Size of Data in bytes
Size uint8
// CBOR-encoded blob whose length is specified by Size
Data []byte
}
func (*EncodedExtendedCKI) Describe
func (e *EncodedExtendedCKI) Describe(indent int)
Describe prints a human-readable description.
func (*EncodedExtendedCKI) Marshal
func (e *EncodedExtendedCKI) Marshal() ([]byte, error)
Marshal serializes the structure to bytes.
func (*EncodedExtendedCKI) Unmarshal
func (e *EncodedExtendedCKI) Unmarshal(data []byte) (int, error)
Unmarshal parses EncodedExtendedCKI from the provided buffer. Returns number of bytes read.
type FekKeyVersion
type FekKeyVersion uint8
const (
FekKeyVersion_1 FekKeyVersion = 0x01
)
func (FekKeyVersion) Marshal
func (fv FekKeyVersion) Marshal() ([]byte, error)
Marshal returns the raw bytes of the FekKeyVersion structure.
Returns: - A byte slice representing the raw bytes of the FekKeyVersion structure. - An error if the conversion fails.
func (FekKeyVersion) String
func (fv FekKeyVersion) String() string
String returns a string representation of the FekKeyVersion.
Returns: - A string representing the FekKeyVersion.
func (*FekKeyVersion) Unmarshal
func (fv *FekKeyVersion) Unmarshal(data []byte) (int, error)
Unmarshal parses the provided byte slice into the FekKeyVersion structure.
Parameters: - data: A byte slice containing the raw FekKeyVersion to be parsed.
Returns: - The number of bytes read from the data. - An error if the parsing fails, otherwise nil.
type Reserved
Reserved represents the Reserved structure.
type Reserved [10]byte
func (*Reserved) Marshal
func (r *Reserved) Marshal() ([]byte, error)
Marshal returns the raw bytes of the Reserved structure.
Returns: - A byte slice representing the raw bytes of the Reserved structure. - An error if the conversion fails.
func (*Reserved) String
func (r *Reserved) String() string
String returns a string representation of the Reserved.
Returns: - A string representing the Reserved.
func (*Reserved) Unmarshal
func (r *Reserved) Unmarshal(data []byte) (int, error)
Unmarshal parses the provided byte slice into the Reserved structure.
Parameters: - data: A byte slice containing the raw reserved to be parsed.
Returns: - The number of bytes read from the data. - An error if the parsing fails, otherwise nil.
Note: The function expects the byte slice to contain 10 bytes. It copies the 10 bytes from the byte slice to the Reserved structure.
type SupportsNotification
type SupportsNotification bool
const (
SupportsNotification_TRUE SupportsNotification = true
SupportsNotification_FALSE SupportsNotification = false
)
func (SupportsNotification) Marshal
func (sn SupportsNotification) Marshal() ([]byte, error)
Marshal returns the raw bytes of the SupportsNotification structure.
Returns: - A byte slice representing the raw bytes of the SupportsNotification structure. - An error if the conversion fails.
func (SupportsNotification) String
func (sn SupportsNotification) String() string
String returns a string representation of the SupportsNotification.
Returns: - A string representing the SupportsNotification.
func (*SupportsNotification) Unmarshal
func (sn *SupportsNotification) Unmarshal(data []byte) (int, error)
Unmarshal parses the provided byte slice into the SupportsNotification structure.
Parameters: - data: A byte slice containing the raw supports notification to be parsed.
Returns: - The number of bytes read from the data. - An error if the parsing fails, otherwise nil.