drkey

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSecretValueBackend

func NewSecretValueBackend(
	db drkey.SecretValueDB,
	masterKey []byte,
	keyDuration time.Duration,
) *secretValueBackend

Types

type Fetcher

type Fetcher interface {
	Level1(ctx context.Context, meta drkey.Level1Meta) (drkey.Level1Key, error)
}

Fetcher obtains a Level1 DRKey from a remote CS.

type Level1ARC

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

Level1ARC maintains an Adaptative Replacement Cache, storing the necessary metadata to prefetch Level1 keys.

func NewLevel1ARC

func NewLevel1ARC(size int) (*Level1ARC, error)

NewLevel1ARC returns a Level1ARC cache of a given size.

func (*Level1ARC) Info

func (c *Level1ARC) Info() []Level1PrefetchInfo

Info returns the list of AS currently in cache.

func (*Level1ARC) Update

func (c *Level1ARC) Update(keyPair Level1PrefetchInfo)

Update is intended to merely update the frequency of a given Level1Key in the ARC cache.

type Level1Engine

type Level1Engine interface {
	GetLevel1Key(ctx context.Context, meta drkey.Level1Meta) (drkey.Level1Key, error)
	GetLevel1PrefetchInfo() []Level1PrefetchInfo
}

type Level1PrefetchInfo

type Level1PrefetchInfo struct {
	IA    addr.IA
	Proto drkey.Protocol
}

Level1PrefetchInfo contains the information to prefetch level1 keys from remote CSes.

type Level1PrefetchListKeeper

type Level1PrefetchListKeeper interface {
	//Update updates the keys in Level1Cache based on the Level1Key metadata.
	Update(key Level1PrefetchInfo)
	// GetLevel1InfoArray retrieves an array whose members contains information regarding
	// level1 keys to prefetch.
	Info() []Level1PrefetchInfo
}

Level1PrefetchListKeeper maintains a list for those level1 keys that are recently/frequently used.

type Prefetcher

type Prefetcher struct {
	LocalIA addr.IA
	Engine  Level1Engine
	// XXX(JordiSubira): At the moment we assume "global" KeyDuration, i.e.
	// every AS involved uses the same EpochDuration. This will be improve
	// further in the future, so that the prefetcher get keys in advance
	// based on the epoch established by the AS which derived the first
	// level key.
	KeyDuration time.Duration
}

Prefetcher is in charge of getting the level 1 keys before they expire.

func (*Prefetcher) Name

func (f *Prefetcher) Name() string

Name returns the tasks name.

func (*Prefetcher) Run

func (f *Prefetcher) Run(ctx context.Context)

Run requests the level 1 keys to other CSs.

type ServiceEngine

type ServiceEngine struct {
	SecretBackend  *secretValueBackend
	LocalIA        addr.IA
	DB             drkey.Level1DB
	Fetcher        Fetcher
	PrefetchKeeper Level1PrefetchListKeeper
}

ServiceEngine maintains and provides secret values, level1 keys and prefetching information.

func (*ServiceEngine) CreateStorageCleaners

func (s *ServiceEngine) CreateStorageCleaners() []*cleaner.Cleaner

CreateStorageCleaners creates Cleaner tasks that remove SecretValue and Level1 keys respectively.

func (*ServiceEngine) DeriveASHost

func (s *ServiceEngine) DeriveASHost(
	ctx context.Context,
	meta drkey.ASHostMeta,
) (drkey.ASHostKey, error)

DeriveASHost returns an AS-Host key based on the presented information.

func (*ServiceEngine) DeriveHostAS

func (s *ServiceEngine) DeriveHostAS(
	ctx context.Context,
	meta drkey.HostASMeta,
) (drkey.HostASKey, error)

DeriveHostAS returns an Host-AS key based on the presented information.

func (*ServiceEngine) DeriveHostHost

func (s *ServiceEngine) DeriveHostHost(
	ctx context.Context,
	meta drkey.HostHostMeta,
) (drkey.HostHostKey, error)

DeriveHostHost returns an Host-Host key based on the presented information.

func (*ServiceEngine) DeriveLevel1

func (s *ServiceEngine) DeriveLevel1(meta drkey.Level1Meta) (drkey.Level1Key, error)

DeriveLevel1 returns a Level1 key based on the presented information.

func (*ServiceEngine) GetLevel1Key

func (s *ServiceEngine) GetLevel1Key(
	ctx context.Context,
	meta drkey.Level1Meta,
) (drkey.Level1Key, error)

GetLevel1Key returns the level 1 drkey from the local DB or, if not found, by asking any CS in the source AS of the key. It also updates the Level1Cache, if needed.

func (*ServiceEngine) GetLevel1PrefetchInfo

func (s *ServiceEngine) GetLevel1PrefetchInfo() []Level1PrefetchInfo

GetLevel1PrefetchInfo returns a list of ASes currently in the cache.

func (*ServiceEngine) GetSecretValue

func (s *ServiceEngine) GetSecretValue(
	ctx context.Context,
	meta drkey.SecretValueMeta,
) (drkey.SecretValue, error)

GetSecretValue returns a valid secret value for the provided metadata. It tries to retrieve the secret value from persistence, otherwise it creates a new one and stores it away.

Directories

Path Synopsis
mock_grpc
Package mock_grpc is a generated GoMock package.
Package mock_grpc is a generated GoMock package.
Package mock_drkey is a generated GoMock package.
Package mock_drkey is a generated GoMock package.

Jump to

Keyboard shortcuts

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