tpm

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SHA1   HashAlgorithm = "sha1"
	SHA256 HashAlgorithm = "sha256"
	SHA384 HashAlgorithm = "sha384"
	SHA512 HashAlgorithm = "sha512"

	RSA KeyAlgorithm = "rsa"
)

Variables

This section is empty.

Functions

func EvictControl

func EvictControl(ctx context.Context, loaded *File, address Address) error

EvictControl

func IsTPMEnabled

func IsTPMEnabled(ctx context.Context) bool

IsTPMEnabled checks if TPM is accessible on this system

func PCRs

func PCRs(ctx context.Context) (map[string][]int, error)

PCRs returns the available PCRs numbers as map of [hash-algorithm][]int

Types

type Address

type Address uint32

func PersistedHandlers

func PersistedHandlers(ctx context.Context) (handlers []Address, err error)

PersistedHandlers return a list of persisted handlers on the system

type File

type File string

File is a tmp file path to make it easier to pass files around

func CreatePCRPolicy

func CreatePCRPolicy(ctx context.Context, selector PCRSelector) (File, error)

CreatePCRPolicy creates a pcr policy from selection

func CreatePrimary

func CreatePrimary(ctx context.Context, hash HashAlgorithm, key KeyAlgorithm) (File, error)

CreatePrimary key

func Load

func Load(ctx context.Context, primary File, obj Object) (loaded File, err error)

func NewFile

func NewFile(suffix string) File

Creates a temporary file handler

func Unseal

func Unseal(ctx context.Context, address Address, pcrs PCRSelector) (File, error)

Unseal object

func (File) Delete

func (f File) Delete() error

Delete file

func (File) Read

func (f File) Read() ([]byte, error)

Read file contents

type HashAlgorithm

type HashAlgorithm string

type HexString

type HexString string

func (HexString) Bytes

func (h HexString) Bytes() ([]byte, error)

type KeyAlgorithm

type KeyAlgorithm string

type Object

type Object struct {
	// contains filtered or unexported fields
}

func Create

func Create(ctx context.Context, hash HashAlgorithm, data io.Reader, primary File, policy File) (Object, error)

Create creates an object

func (*Object) Delete

func (o *Object) Delete() error

type PCRSelector

type PCRSelector map[HashAlgorithm][]int

func (PCRSelector) String

func (p PCRSelector) String() string

Jump to

Keyboard shortcuts

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