Documentation ¶
Index ¶
- Variables
- func BlackHoleContext(ctx context.Context) context.Context
- func NewContext(ctx context.Context, t TPMStore) context.Context
- type AK
- type Dirstore
- func (s *Dirstore) AddAK(ak *AK) error
- func (s *Dirstore) AddKey(key *Key) error
- func (s *Dirstore) DeleteAK(name string) error
- func (s *Dirstore) DeleteKey(name string) error
- func (s *Dirstore) GetAK(name string) (*AK, error)
- func (s *Dirstore) GetKey(name string) (*Key, error)
- func (s *Dirstore) ListAKNames() []string
- func (s *Dirstore) ListAKs() ([]*AK, error)
- func (s *Dirstore) ListKeyNames() []string
- func (s *Dirstore) ListKeys() ([]*Key, error)
- func (s *Dirstore) Load() error
- func (s *Dirstore) Persist() error
- func (s *Dirstore) UpdateAK(ak *AK) error
- func (s *Dirstore) UpdateKey(key *Key) error
- type FeedthroughStore
- func (f *FeedthroughStore) AddAK(ak *AK) error
- func (f *FeedthroughStore) AddKey(key *Key) error
- func (f *FeedthroughStore) DeleteAK(name string) error
- func (f *FeedthroughStore) DeleteKey(name string) error
- func (f *FeedthroughStore) GetAK(name string) (*AK, error)
- func (f *FeedthroughStore) GetKey(name string) (*Key, error)
- func (f *FeedthroughStore) ListAKNames() []string
- func (f *FeedthroughStore) ListAKs() ([]*AK, error)
- func (f *FeedthroughStore) ListKeyNames() []string
- func (f *FeedthroughStore) ListKeys() ([]*Key, error)
- func (f *FeedthroughStore) Load() error
- func (f *FeedthroughStore) Persist() error
- func (f *FeedthroughStore) UpdateAK(ak *AK) error
- func (f *FeedthroughStore) UpdateKey(key *Key) error
- type Filestore
- func (s *Filestore) AddAK(ak *AK) error
- func (s *Filestore) AddKey(k *Key) error
- func (s *Filestore) DeleteAK(name string) error
- func (s *Filestore) DeleteKey(name string) error
- func (s *Filestore) GetAK(name string) (*AK, error)
- func (s *Filestore) GetKey(name string) (*Key, error)
- func (s *Filestore) ListAKNames() []string
- func (s *Filestore) ListAKs() ([]*AK, error)
- func (s *Filestore) ListKeyNames() []string
- func (s *Filestore) ListKeys() ([]*Key, error)
- func (s *Filestore) Load() error
- func (s *Filestore) Persist() error
- func (s *Filestore) UpdateAK(ak *AK) error
- func (s *Filestore) UpdateKey(k *Key) error
- type Key
- type TPMStore
Constants ¶
This section is empty.
Variables ¶
var ErrExists = errors.New("already exists")
ErrExists is returned when a Key or AK already exists in storage
var ErrNoStorageConfigured = errors.New("no storage configured")
ErrNoStorageConfigured is returned when a TPM operation is performed that requires a storage to have been configured
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a Key or AK cannot be found in storage
Functions ¶
func BlackHoleContext ¶
BlackholeContext adds a new BlackHole storage to the context.
Types ¶
type AK ¶
AK is the type used to store AKs.
func (*AK) MarshalJSON ¶
MarshalJSON marshals the AK into JSON.
func (*AK) UnmarshalJSON ¶
UnmarshalJSON unmarshals `data` into an AK.
type Dirstore ¶
type Dirstore struct {
// contains filtered or unexported fields
}
Dirstore is a concrete implementation of the TPMStore interface that stores TPM objects in a directory. Each object will be stored in a separate file in the directory. The name of the file is constructed by prefixing the name of the object with its type.
func NewDirstore ¶
NewDirstore creates a new instance of a Direstore.
func (*Dirstore) ListAKNames ¶
func (*Dirstore) ListKeyNames ¶
type FeedthroughStore ¶
type FeedthroughStore struct {
// contains filtered or unexported fields
}
FeedthroughStore is a TPMStore that feeds through storage operations to the underlying TPMStore. If no backing TPMStore is set, but the operation requires one, ErrNoStorageConfigured will be returned.
func NewFeedthroughStore ¶
func NewFeedthroughStore(store TPMStore) *FeedthroughStore
func (*FeedthroughStore) AddAK ¶
func (f *FeedthroughStore) AddAK(ak *AK) error
func (*FeedthroughStore) AddKey ¶
func (f *FeedthroughStore) AddKey(key *Key) error
func (*FeedthroughStore) DeleteAK ¶
func (f *FeedthroughStore) DeleteAK(name string) error
func (*FeedthroughStore) DeleteKey ¶
func (f *FeedthroughStore) DeleteKey(name string) error
func (*FeedthroughStore) ListAKNames ¶
func (f *FeedthroughStore) ListAKNames() []string
func (*FeedthroughStore) ListAKs ¶
func (f *FeedthroughStore) ListAKs() ([]*AK, error)
func (*FeedthroughStore) ListKeyNames ¶
func (f *FeedthroughStore) ListKeyNames() []string
func (*FeedthroughStore) ListKeys ¶
func (f *FeedthroughStore) ListKeys() ([]*Key, error)
func (*FeedthroughStore) Load ¶
func (f *FeedthroughStore) Load() error
func (*FeedthroughStore) Persist ¶
func (f *FeedthroughStore) Persist() error
func (*FeedthroughStore) UpdateAK ¶
func (f *FeedthroughStore) UpdateAK(ak *AK) error
func (*FeedthroughStore) UpdateKey ¶
func (f *FeedthroughStore) UpdateKey(key *Key) error
type Filestore ¶
type Filestore struct {
// contains filtered or unexported fields
}
Filestore is a concrete implementation of the TPMStore interface that keeps an in-memory map of AKs and TPM Keys. The current state of the in-memory storage can be persisted to a file.
func NewFilestore ¶
NewFilestore creates a new instance of a Filestore
TODO: provide options for filepath (with default), gzip, persistence en-/disabled, ... ?
func (*Filestore) ListAKNames ¶
func (*Filestore) ListKeyNames ¶
type Key ¶
type Key struct { Name string Data []byte AttestedBy string Chain []*x509.Certificate CreatedAt time.Time }
Key is the type used to store Keys.
func (*Key) MarshalJSON ¶
MarshalJSON marshals the Key into JSON.
func (*Key) UnmarshalJSON ¶
UnmarshalJSON unmarshals `data` into a Key.
type TPMStore ¶
type TPMStore interface { ListKeys() ([]*Key, error) ListKeyNames() []string GetKey(name string) (*Key, error) AddKey(key *Key) error UpdateKey(key *Key) error DeleteKey(name string) error ListAKs() ([]*AK, error) ListAKNames() []string GetAK(name string) (*AK, error) AddAK(ak *AK) error UpdateAK(ak *AK) error DeleteAK(name string) error Persist() error Load() error }
TPMStore is the interface that TPM storage implementations need to implement.
func BlackHole ¶
func BlackHole() TPMStore
BlackHole returns a FeedthroughStore without a backing storage, effectively resulting in no persistence. Note that some operations do require persistence, in which case ErrNoStorageConfigured will be returned by the FeedthroughStore.
func FromContext ¶
FromContext retrieves a TPMStore from the context.
It panics when there's no TPMStore present.