Documentation
¶
Index ¶
- Constants
- type DNWithBinary
- type KeyCredential
- func (kc *KeyCredential) CheckIntegrity() bool
- func (kc *KeyCredential) ComputeKeyHash() []byte
- func (kc *KeyCredential) Describe(indent int)
- func (kc *KeyCredential) FromBytes(rawBytes []byte) error
- func (kc *KeyCredential) ParseDNWithBinary(dnWithBinary DNWithBinary) error
- func (kc *KeyCredential) ToBytes() ([]byte, error)
Constants ¶
const ( StringFormatPrefix = "B:" StringFormatSeparator = ":" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DNWithBinary ¶
type DNWithBinary struct {
DistinguishedName string
BinaryData []byte
// Internal
RawBytes []byte
RawBytesSize uint32
}
func (*DNWithBinary) Describe ¶
func (d *DNWithBinary) Describe(indent int)
Describe prints a detailed description of the DNWithBinary structure.
Parameters: - indent: An integer value specifying the indentation level for the output.
func (*DNWithBinary) Parse ¶
func (d *DNWithBinary) Parse(rawBytes []byte) error
func (*DNWithBinary) String ¶
func (d *DNWithBinary) String() string
func (*DNWithBinary) ToString ¶
func (d *DNWithBinary) ToString() string
type KeyCredential ¶
type KeyCredential struct {
Version key.KeyCredentialVersion
Identifier string
KeyHash []byte
RawKeyMaterial crypto.RSAKeyMaterial
Usage key.KeyUsage
LegacyUsage string
Source key.KeySource
CustomKeyInfo key.CustomKeyInformation
DeviceId guid.GUID
LastLogonTime utils.DateTime
CreationTime utils.DateTime
// Internal
RawBytes []byte
RawBytesSize uint32
}
KeyCredential represents a key credential structure used for authentication and authorization.
Fields: - Version: A KeyCredentialVersion object representing the version of the key credential. - Identifier: A string representing the unique identifier of the key credential. - KeyHash: A byte slice containing the hash of the key material. - RawKeyMaterial: An RSAKeyMaterial object representing the raw RSA key material. - Usage: A KeyUsage object representing the usage of the key credential. - LegacyUsage: A string representing the legacy usage of the key credential. - Source: A KeySource object representing the source of the key credential. - LastLogonTime: A DateTime object representing the last logon time associated with the key credential. - CreationTime: A DateTime object representing the creation time of the key credential. - Owner: A string representing the owner of the key credential. - RawBytes: A byte slice containing the raw binary data of the key credential. - RawBytesSize: A uint32 value representing the size of the raw binary data.
Methods: - ParseDNWithBinary: Parses the provided DNWithBinary object into the KeyCredential structure.
Note: The KeyCredential structure is used to store and manage key credentials, which are used for authentication and authorization purposes. The structure includes fields for version, identifier, key hash, raw key material, usage, legacy usage, source, last logon time, creation time, owner, and raw binary data. The ParseDNWithBinary method is used to parse a DNWithBinary object and populate the fields of the KeyCredential structure.
func NewKeyCredential ¶
func NewKeyCredential( Version key.KeyCredentialVersion, Identifier string, RawKeyMaterial crypto.RSAKeyMaterial, DeviceId guid.GUID, LastLogonTime utils.DateTime, CreationTime utils.DateTime, ) *KeyCredential
NewKeyCredential creates a new KeyCredential structure.
Parameters:
- version: A KeyCredentialVersion object representing the version of the key credential.
- Identifier: A string representing the unique identifier of the key credential.
- KeyHash: A byte slice containing the hash of the key material.
- RawKeyMaterial: An RSAKeyMaterial object representing the raw RSA key material.
- Usage: A KeyUsage object representing the usage of the key credential.
- LegacyUsage: A string representing the legacy usage of the key credential.
- Source: A KeySource object representing the source of the key credential.
- CustomKeyInfo: A CustomKeyInformation object representing the custom key information of the key credential.
- DeviceId: A GUID object representing the device ID of the key credential.
- LastLogonTime: A DateTime object representing the last logon time associated with the key credential.
- CreationTime: A DateTime object representing the creation time of the key credential.
- Owner: A string representing the owner of the key credential.
Returns:
- A pointer to a KeyCredential object.
func (*KeyCredential) CheckIntegrity ¶
func (kc *KeyCredential) CheckIntegrity() bool
CheckIntegrity checks the integrity of the key credential.
Returns: - A boolean value indicating the integrity of the key credential.
func (*KeyCredential) ComputeKeyHash ¶
func (kc *KeyCredential) ComputeKeyHash() []byte
ComputeKeyHash computes the key hash of the key credential.
Returns: - A byte slice containing the key hash.
func (*KeyCredential) Describe ¶
func (kc *KeyCredential) Describe(indent int)
Describe prints a detailed description of the KeyCredential structure.
Parameters: - indent: An integer value specifying the indentation level for the output.
func (*KeyCredential) FromBytes ¶
func (kc *KeyCredential) FromBytes(rawBytes []byte) error
ParseDNWithBinary parses the provided DNWithBinary object into the KeyCredential structure.
Parameters: - dnWithBinary: A DNWithBinary object containing the distinguished name and binary data to be parsed.
Returns: - An error if the parsing fails, otherwise nil.
Note: The function performs the following steps: 1. Sets the RawBytes and RawBytesSize fields to the provided binary data and its length, respectively. 2. Sets the Owner field to the distinguished name from the DNWithBinary object. 3. Parses the version information from the binary data and updates the RawBytesSize and remainder accordingly. 4. Iterates through the remaining binary data, parsing each entry based on its type and length. 5. Updates the corresponding fields of the KeyCredential structure based on the parsed entry type and data.
The function handles various entry types, including key identifier, key hash, key material, key usage, legacy usage, key source, last logon time, and creation time. Unsupported entry types, such as device ID and custom key information, are commented out for future implementation.
func (*KeyCredential) ParseDNWithBinary ¶
func (kc *KeyCredential) ParseDNWithBinary(dnWithBinary DNWithBinary) error
ParseDNWithBinary parses the provided DNWithBinary object into the KeyCredential structure.
Parameters: - dnWithBinary: A DNWithBinary object containing the distinguished name and binary data to be parsed.
Returns: - An error if the parsing fails, otherwise nil.
Note: The function performs the following steps: 1. Sets the RawBytes and RawBytesSize fields to the provided binary data and its length, respectively. 2. Sets the Owner field to the distinguished name from the DNWithBinary object. 3. Parses the version information from the binary data and updates the RawBytesSize and remainder accordingly. 4. Iterates through the remaining binary data, parsing each entry based on its type and length. 5. Updates the corresponding fields of the KeyCredential structure based on the parsed entry type and data.
The function handles various entry types, including key identifier, key hash, key material, key usage, legacy usage, key source, last logon time, and creation time. Unsupported entry types, such as device ID and custom key information, are commented out for future implementation.
func (*KeyCredential) ToBytes ¶
func (kc *KeyCredential) ToBytes() ([]byte, error)
ToBytes returns the raw bytes of the KeyCredential structure.
Returns: - A byte slice representing the raw bytes of the KeyCredential structure. - An error if the conversion fails.