Generated from Manticore v1.1.5 • 201 packages. View on pkg.go.dev

usage

import "github.com/TheManticoreProject/Manticore/windows/keycredentiallink/key/usage"

Index

Constants

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
)

type KeyUsage

type KeyUsage struct {
    Value uint8

    // Internal
    RawBytes     []byte
    RawBytesSize uint8
}

func (*KeyUsage) Marshal

func (ku *KeyUsage) Marshal() ([]byte, error)

Marshal returns the raw bytes of the KeyUsage structure.

Returns: - A byte slice representing the raw bytes of the KeyUsage structure. - An error if the conversion fails.

func (*KeyUsage) String

func (ku *KeyUsage) String() string

String returns a string representation of the key usage.

Returns: - A string representing the key usage.

func (*KeyUsage) Unmarshal

func (ku *KeyUsage) Unmarshal(data []byte) (int, error)

Unmarshal parses the key usage from a byte array.

Parameters: - data: A byte array representing the key usage.

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 usage. It extracts the key usage value from the byte slice and assigns it to the KeyUsage structure.