Documentation
¶
Overview ¶
Package memory implements server state using non-persistent memory to complement internal/token.Service for state that must persist between protocol sessions.
Index ¶
- type KeyTypeAndRsaBits
- type State
- func (s *State) AddVoucher(_ context.Context, ov *fdo.Voucher) error
- func (s *State) ManufacturerKey(ctx context.Context, keyType protocol.KeyType, rsaBits int) (crypto.Signer, []*x509.Certificate, error)
- func (s *State) NewVoucher(_ context.Context, ov *fdo.Voucher) error
- func (s *State) OwnerKey(ctx context.Context, keyType protocol.KeyType, rsaBits int) (crypto.Signer, []*x509.Certificate, error)
- func (s *State) RVBlob(ctx context.Context, guid protocol.GUID) (*cose.Sign1[protocol.To1d, []byte], *fdo.Voucher, error)
- func (s *State) RemoveVoucher(ctx context.Context, guid protocol.GUID) (*fdo.Voucher, error)
- func (s *State) ReplaceVoucher(_ context.Context, oldGUID protocol.GUID, ov *fdo.Voucher) error
- func (s *State) SetRVBlob(ctx context.Context, ov *fdo.Voucher, to1d *cose.Sign1[protocol.To1d, []byte], ...) error
- func (s *State) Voucher(_ context.Context, guid protocol.GUID) (*fdo.Voucher, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyTypeAndRsaBits ¶
KeyTypeAndRsaBits identifies an owner/manufacturer key by its type and bit size.
type State ¶
type State struct { RVBlobs map[protocol.GUID]*cose.Sign1[protocol.To1d, []byte] Vouchers map[protocol.GUID]*fdo.Voucher OwnerKeys map[KeyTypeAndRsaBits]struct { Key crypto.Signer Chain []*x509.Certificate } }
State implements interfaces for state which must be persisted between protocol sessions, but not between server processes.
func (*State) AddVoucher ¶
AddVoucher stores the voucher of a device owned by the service.
func (*State) ManufacturerKey ¶
func (s *State) ManufacturerKey(ctx context.Context, keyType protocol.KeyType, rsaBits int) (crypto.Signer, []*x509.Certificate, error)
ManufacturerKey returns the signer of a given key type and its certificate chain (required). If key type is not RSAPKCS or RSAPSS then rsaBits is ignored. Otherwise it must be either 2048 or 3072.
func (*State) NewVoucher ¶
NewVoucher creates and stores a voucher for a newly initialized device. Note that the voucher may have entries if the server was configured for auto voucher extension.
func (*State) OwnerKey ¶
func (s *State) OwnerKey(ctx context.Context, keyType protocol.KeyType, rsaBits int) (crypto.Signer, []*x509.Certificate, error)
OwnerKey returns the private key matching a given key type and optionally its certificate chain. If key type is not RSAPKCS or RSAPSS then rsaBits is ignored. Otherwise it must be either 2048 or 3072.
func (*State) RVBlob ¶
func (s *State) RVBlob(ctx context.Context, guid protocol.GUID) (*cose.Sign1[protocol.To1d, []byte], *fdo.Voucher, error)
RVBlob returns the owner rendezvous blob for a device.
func (*State) RemoveVoucher ¶
RemoveVoucher untracks a voucher, possibly by deleting it or marking it as removed, and returns it for extension.
func (*State) ReplaceVoucher ¶
ReplaceVoucher stores a new voucher, possibly deleting or marking the previous voucher as replaced.