resourceattribute

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package resourceattribute implements the codec for the resource-attribute data carried in a SYSTEM_RESOURCE_ATTRIBUTE_ACE (MS-DTYP 2.4.4.15). The ACE's ApplicationData is a CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 structure (MS-DTYP 2.4.10.1); this package converts between that binary form and the SDDL attribute-data text `"name",TYPE,flags,value,...` (MS-DTYP 2.5.1.1).

text  -> Marshal   -> CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 bytes
bytes -> Unmarshal -> text

The structure is offset-based: a fixed 16-byte header (Name, ValueType, Reserved, Flags, ValueCount) is followed by an array of ValueCount DWORD offsets, each pointing (from the start of the structure) to a value; the attribute name and the values themselves follow. All integers are little-endian and the whole structure is padded to a DWORD boundary.

Index

Constants

View Source
const (
	TypeInt64       uint16 = 0x0001
	TypeUint64      uint16 = 0x0002
	TypeString      uint16 = 0x0003
	TypeSID         uint16 = 0x0005
	TypeBoolean     uint16 = 0x0006
	TypeOctetString uint16 = 0x0010
)

CLAIM_SECURITY_ATTRIBUTE_TYPE value-type codes (MS-DTYP 2.4.10.1).

Variables

This section is empty.

Functions

func Marshal

func Marshal(attrData string) ([]byte, error)

Marshal parses an SDDL attribute-data string (optionally wrapped in a single outer pair of parentheses, as it appears in an ACE) and returns the binary CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 encoding.

func Unmarshal

func Unmarshal(data []byte) (string, error)

Unmarshal decodes CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 bytes into the SDDL attribute-data text (without an outer pair of parentheses).

Types

type ResourceAttribute

type ResourceAttribute struct {
	Name      string
	ValueType uint16
	Flags     uint32

	Ints    []int64  // TypeInt64, TypeUint64, TypeBoolean
	Strings []string // TypeString
	SIDs    []string // TypeSID (string form)
	Octets  [][]byte // TypeOctetString
}

ResourceAttribute is the decoded representation of a resource attribute. Exactly one of the value slices is populated, chosen by ValueType.

func Decode

func Decode(data []byte) (*ResourceAttribute, error)

Decode parses CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 bytes.

func Parse

func Parse(attrData string) (*ResourceAttribute, error)

Parse converts SDDL attribute-data text into a ResourceAttribute.

func (*ResourceAttribute) Encode

func (ra *ResourceAttribute) Encode() ([]byte, error)

Encode serializes the ResourceAttribute into binary form.

func (*ResourceAttribute) String

func (ra *ResourceAttribute) String() string

String renders the resource attribute as SDDL attribute-data text (without an outer pair of parentheses).

Jump to

Keyboard shortcuts

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