state

package
v3.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientStateTypeV2 = "client-state/2"
	ClientStateTypeV3 = "client-state/3"
	ClientStateType   = ClientStateTypeV3

	// DefaultVendorSubdir is the name of the subdirectory we create in various common locations (f.e. /var, /etc) to store our data
	// note: if you change this name, you also have to modify the reference in the windows installer wix main xml file
	DefaultVendorSubdir string = "immune-guard"

	DummyTPMIdentifier string = "dummy"
)

Variables

View Source
var (
	ErrNotExist = errors.New("non existent")
	ErrInvalid  = errors.New("invalid data")
	ErrNoPerm   = errors.New("no permissions")
)

Functions

func DefaultStateDir added in v3.4.0

func DefaultStateDir() string

func DefaultTPMDevice added in v3.4.0

func DefaultTPMDevice() string

Types

type DeviceKey

type DeviceKey DeviceKeyV3

type DeviceKeyV3

type DeviceKeyV3 struct {
	Public     api.PublicKey `json:"public"`
	Private    api.Buffer    `json:"private"`
	Auth       string        `json:"auth"`
	Credential string        `json:"credential"`
}

type RootKeyV3

type RootKeyV3 struct {
	Auth string   `json:"auth"`
	Name api.Name `json:"name"`
}

type State

type State StateV3

Current "head" state struct definition

func LoadState

func LoadState(keysPath string) (*State, bool, error)

LoadState returns a loaded state and a bool if it has been updated or error

func NewState

func NewState() *State

func (*State) EnsureFresh

func (s *State) EnsureFresh(cl *api.Client) (bool, error)

func (*State) IsEnrolled

func (s *State) IsEnrolled() bool

func (*State) Store

func (st *State) Store(keysPath string) error

type StateTpmKey

type StateTpmKey struct {
	Public      api.PublicKey `json:"public"`
	Private     api.Buffer    `json:"private"`
	Auth        string        `json:"auth"`
	Certificate string        `json:"certificate"`
}

type StateV2

type StateV2 struct {
	Ty                     string           `json:"type"`
	EndorsementKey         api.PublicKey    `json:"ek"`
	EndorsementCertificate *api.Certificate `json:"ek-certificate"`
	RootKeyAuth            string           `json:"root-key-auth"`
	QuoteKey               StateTpmKey      `json:"quote-key"`
}

Mutable run time data.

type StateV3

type StateV3 struct {
	Ty string `json:"type"`

	StubSeed  api.Buffer `json:"stub-seed,omitempty"`  // v3.1 (deprecated)
	StubState *StubState `json:"stub-state,omitempty"` // v3.2

	// /v2/enroll
	Keys                   map[string]DeviceKeyV3 `json:"keys"`
	Root                   RootKeyV3              `json:"root"`
	EndorsementKey         api.PublicKey          `json:"ek"`
	EndorsementCertificate *api.Certificate       `json:"ek-certificate"`
	TPM                    string                 `json:"tpm,omitempty"` // v3.3

	// /v2/configuration
	LastUpdate time.Time         `json:"last_update,string"`
	Config     api.Configuration `json:"config"`
}

func (*StateV3) EnsureFresh

func (s *StateV3) EnsureFresh(cl *api.Client) (bool, error)

returns true if a new config was fetched

func (*StateV3) IsEnrolled

func (s *StateV3) IsEnrolled() bool

type StubState

type StubState struct {
	Type           string
	RootKey        api.Buffer `json:"root"`
	EndorsementKey api.Buffer `json:"ek"`
}

Jump to

Keyboard shortcuts

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