drkey

package
v0.0.0-...-092914e Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseDB

type BaseDB interface {
	io.Closer
	db.LimitSetter
}

BaseDB defines basic interface

type DRKey

type DRKey []byte

DRKey represents a raw binary key

func (DRKey) Equal

func (k DRKey) Equal(other DRKey) bool

Equal returns true if both DRKeys are identical

func (DRKey) String

func (k DRKey) String() string

type DelegationSecret

type DelegationSecret struct {
	Protocol string
	Epoch    Epoch
	SrcIA    addr.IA
	DstIA    addr.IA
	Key      DRKey
}

DelegationSecret is similar to a level 2 key, type AS to AS.

type Epoch

type Epoch struct {
	scrypto.Validity
}

Epoch represents a validity period.

func NewEpoch

func NewEpoch(begin, end uint32) Epoch

NewEpoch constructs an Epoch from its uint32 encoded begin and end parts.

func (*Epoch) Contains

func (e *Epoch) Contains(t time.Time) bool

Contains indicates whether the time point is inside this Epoch.

func (Epoch) Equal

func (e Epoch) Equal(other Epoch) bool

Equal returns true if both Epochs are identical.

type Lvl1DB

type Lvl1DB interface {
	BaseDB
	GetLvl1Key(ctx context.Context, key Lvl1Meta, valTime uint32) (Lvl1Key, error)
	InsertLvl1Key(ctx context.Context, key Lvl1Key) error
	RemoveOutdatedLvl1Keys(ctx context.Context, cutoff uint32) (int64, error)
	GetLvl1SrcASes(ctx context.Context) ([]addr.IA, error)
	GetValidLvl1SrcASes(ctx context.Context, valTime uint32) ([]addr.IA, error)
}

Lvl1DB is the drkey database interface for level 1.

type Lvl1Key

type Lvl1Key struct {
	Lvl1Meta
	Key DRKey
}

Lvl1Key represents a level 1 DRKey.

func (Lvl1Key) Equal

func (k Lvl1Key) Equal(other Lvl1Key) bool

Equal returns true if both level 1 keys are identical.

type Lvl1Meta

type Lvl1Meta struct {
	Epoch Epoch
	SrcIA addr.IA
	DstIA addr.IA
}

Lvl1Meta represents the information about a level 1 DRKey other than the key itself.

func (Lvl1Meta) Equal

func (m Lvl1Meta) Equal(other Lvl1Meta) bool

Equal returns true if both meta are identical.

type Lvl2DB

type Lvl2DB interface {
	BaseDB
	GetLvl2Key(ctx context.Context, key Lvl2Meta, valTime uint32) (Lvl2Key, error)
	InsertLvl2Key(ctx context.Context, key Lvl2Key) error
	RemoveOutdatedLvl2Keys(ctx context.Context, cutoff uint32) (int64, error)
}

Lvl2DB is the drkey database interface for level 2.

type Lvl2Key

type Lvl2Key struct {
	Lvl2Meta
	Key DRKey
}

Lvl2Key represents a level 2 DRKey.

func (Lvl2Key) Equal

func (k Lvl2Key) Equal(other Lvl2Key) bool

Equal returns true if both level 2 keys are identical.

type Lvl2KeyType

type Lvl2KeyType uint8

Lvl2KeyType represents the different types of level 2 DRKeys (AS->AS, AS->host, host->host).

const (
	AS2AS Lvl2KeyType = iota
	AS2Host
	Host2Host
)

Lvl2KeyType constants

type Lvl2Meta

type Lvl2Meta struct {
	KeyType  Lvl2KeyType
	Protocol string
	Epoch    Epoch
	SrcIA    addr.IA
	DstIA    addr.IA
	SrcHost  addr.HostAddr
	DstHost  addr.HostAddr
}

Lvl2Meta represents the information about a level 2 DRKey, without the key itself.

func (Lvl2Meta) Equal

func (m Lvl2Meta) Equal(other Lvl2Meta) bool

Equal returns true if both meta are identical.

type SV

type SV struct {
	SVMeta
	Key DRKey
}

SV represents a DRKey secret value.

func DeriveSV

func DeriveSV(meta SVMeta, asSecret []byte) (SV, error)

DeriveSV constructs a valid SV. asSecret is typically the AS master secret.

func (SV) Equal

func (sv SV) Equal(other SV) bool

Equal returns true if both secret values are identical.

type SVMeta

type SVMeta struct {
	Epoch Epoch
}

SVMeta represents the information about a DRKey secret value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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