netcertstore

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package netcertstore hosts the NetCertStore. It is a certificate/key store for network-related tests (such as VPN and WiFi).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store contains the information to use TPM to store certificates/keys during the test. Strictly speaking, this struct holds the information required to access a chaps slot/token. Note that Store is currently a singleton because users of this struct (network tests) only need one Store at a moment and handling multiple Store at a time adds unnecessary complexity.

func CreateStore

func CreateStore(ctx context.Context, runner hwsec.CmdRunner) (result *Store, retErr error)

CreateStore sets up a Store for network testing. Note that rebooting the DUT or restarting the cryptohomed/chapsd daemon will invalidate the store returned by this method. It is the caller's responsibility to call Cleanup() before rebooting or restarting the daemon. NetCertStore only support devices/boards with TPM.

func (*Store) Cleanup

func (s *Store) Cleanup(ctx context.Context) error

Cleanup resets the environment (chaps keystore and cryptohome vault) back to the state before the Store instance is created.

func (*Store) InstallCertKeyPair

func (s *Store) InstallCertKeyPair(ctx context.Context, key, certificate string) (identifier string, retErr error)

InstallCertKeyPair installs a key and its certificate into the TPM. key is the private key in PEM format; certificate is the certificate in PEM format. The returned identifier is the ID to the object when inserted into the user token.

func (*Store) Label

func (s *Store) Label() string

Label returns the label of the PKCS#11 slot/token for testing.

func (*Store) NextID

func (s *Store) NextID() string

NextID returns the next object ID that's available for use.

func (*Store) Pin

func (s *Store) Pin() string

Pin returns the pin to access the PKCS#11 slot/token for testing.

func (*Store) Slot

func (s *Store) Slot() int

Slot returns the slot number to access the PKCS#11 slot/token for testing.

Jump to

Keyboard shortcuts

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