tpmsimulator

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUsingClosedSimulator = simulator.ErrUsingClosedSimulator
)

Functions

This section is empty.

Types

type Credential

type Credential struct {
	Certificate   *x509.Certificate
	Intermediates []*x509.Certificate
	PrivateBlob   []byte
	PublicBlob    []byte
}

func (*Credential) Chain

func (c *Credential) Chain() [][]byte

Chain returns the leaf and intermediate certificates in DER format

func (*Credential) ChainPem

func (c *Credential) ChainPem() []byte

ChainPem returns the leaf and intermediate certificates in PEM format

type KeyType

type KeyType int
const (
	RSA KeyType = iota
	ECC
)

type ProvisioningAuthority

type ProvisioningAuthority struct {
	RootCert         *x509.Certificate
	RootKey          *rsa.PrivateKey
	IntermediateCert *x509.Certificate
	IntermediateKey  *rsa.PrivateKey
}

func NewProvisioningCA

func NewProvisioningCA(c *ProvisioningConf) (*ProvisioningAuthority, error)

NewProvisioningCA creates a new provisioning authority to issue DevIDs certificate. If root certificate and key are not provided, a new, self-signed certificate and key are generated.

type ProvisioningConf

type ProvisioningConf struct {
	NoIntermediates bool
	RootCertificate *x509.Certificate
	RootKey         *rsa.PrivateKey
}

type TPMSimulator

type TPMSimulator struct {
	*simulator.Simulator
	// contains filtered or unexported fields
}

func New

func New(endorsementHierarchyPassword, ownerHierarchyPassword string) (*TPMSimulator, error)

New creates a new TPM simulator and sets an RSA endorsement certificate.

func (*TPMSimulator) GenerateDevID

func (s *TPMSimulator) GenerateDevID(p *ProvisioningAuthority, keyType KeyType, keyPassword string) (*Credential, error)

GenerateDevID generates a new DevID credential using the given provisioning authority and key type. DevIDs generated using this function are for test only. There is not guarantee that the identities generated by this method are compliant with the TCG/IEEE specification.

func (*TPMSimulator) GetEKRoot

func (s *TPMSimulator) GetEKRoot() *x509.Certificate

GetEKRoot returns the manufacturer CA used to sign the endorsement certificate

func (*TPMSimulator) OpenTPM

func (s *TPMSimulator) OpenTPM(path ...string) (io.ReadWriteCloser, error)

func (*TPMSimulator) SetEndorsementCertificate

func (s *TPMSimulator) SetEndorsementCertificate(ekCert []byte) error

Jump to

Keyboard shortcuts

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