key

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSRK

func CreateSRK(tpm transport.TPMCloser, keytype tpm2.TPMAlgID) (*tpm2.AuthHandle, *tpm2.TPMTPublic, error)

Creates a Storage Key, or return the loaded storage key

func EncodeKey

func EncodeKey(k *Key) []byte

func LoadKey

func LoadKey(tpm transport.TPMCloser, key *Key) (*tpm2.AuthHandle, error)

func LoadKeyWithParent

func LoadKeyWithParent(tpm transport.TPMCloser, parent tpm2.AuthHandle, key *Key) (*tpm2.AuthHandle, error)

func MarshalKey

func MarshalKey(k *Key) []byte

Types

type Key

type Key struct {
	Version uint8
	PIN     PINStatus
	Type    tpm2.TPMAlgID
	Private tpm2.TPM2BPrivate
	Public  tpm2.TPM2BPublic
	Comment []byte
}

func CreateKey

func CreateKey(tpm transport.TPMCloser, keytype tpm2.TPMAlgID, pin, comment []byte) (*Key, error)

func DecodeKey

func DecodeKey(pemBytes []byte) (*Key, error)

func ImportKey added in v0.2.0

func ImportKey(tpm transport.TPMCloser, pk any, pin, comment []byte) (*Key, error)

func UnmarshalKey

func UnmarshalKey(b []byte) (*Key, error)

func (*Key) PublicKey

func (k *Key) PublicKey() (any, error)

func (*Key) SSHPublicKey

func (k *Key) SSHPublicKey() (ssh.PublicKey, error)

type PINStatus

type PINStatus uint8

We need to know if the TPM handle has a pin set

const (
	NoPIN PINStatus = iota
	HasPIN
)

func (PINStatus) String

func (p PINStatus) String() string

Jump to

Keyboard shortcuts

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