conf

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ASFile

func ASFile(dir string, ia addr.IA, version scrypto.Version) string

ASFile returns the file where the AS certificate config is written to.

func AllTRCFiles

func AllTRCFiles(dir string, isd addr.ISD) string

AllTRCFiles returns a glob string that matches all TRC files for the given isd.

func IssuerFile

func IssuerFile(dir string, ia addr.IA, version scrypto.Version) string

IssuerFile returns the file where the issuer certificate config is written to.

func KeysFile

func KeysFile(dir string, ia addr.IA) string

KeysFile returns the file where the keys config is written to.

func TRCFile

func TRCFile(dir string, isd addr.ISD, version scrypto.Version) string

TRCFile returns the file where the TRC config is written to.

Types

type AS

type AS struct {
	Description          string              `toml:"description"`
	Version              scrypto.Version     `toml:"version"`
	SigningKeyVersion    *scrypto.KeyVersion `toml:"signing_key_version"`
	EncryptionKeyVersion *scrypto.KeyVersion `toml:"encryption_key_version"`
	RevocationKeyVersion *scrypto.KeyVersion `toml:"revocation_key_version"`
	IssuerIA             addr.IA             `toml:"issuer_ia"`
	IssuerCertVersion    scrypto.Version     `toml:"issuer_cert_version"`
	OptDistPoints        []addr.IA           `toml:"optional_distribution_points"`
	Validity             Validity            `toml:"validity"`
}

AS holds the AS certificate configuration.

func LoadAS

func LoadAS(file string) (AS, error)

LoadAS loads the AS certificate configuration from the provided file. The contents are already validated.

func (AS) Encode

func (cfg AS) Encode(w io.Writer) error

Encode writes the encoded AS certificate config to the writer.

func (AS) Validate

func (cfg AS) Validate() error

Validate checks all values are set.

type Issuer

type Issuer struct {
	Description          string              `toml:"description"`
	Version              scrypto.Version     `toml:"version"`
	IssuingKeyVersion    *scrypto.KeyVersion `toml:"issuing_key_version"`
	RevocationKeyVersion *scrypto.KeyVersion `toml:"revocation_key_version"`
	TRCVersion           scrypto.Version     `toml:"trc_version"`
	OptDistPoints        []addr.IA           `toml:"optional_distribution_points"`
	Validity             Validity            `toml:"validity"`
}

Issuer holds the issuer certificate configuration.

func LoadIssuer

func LoadIssuer(file string) (Issuer, error)

LoadIssuer loads the issuer certificate configuration from the provided file. The contents are already validated.

func (Issuer) Encode

func (cfg Issuer) Encode(w io.Writer) error

Encode writes the encoded issuer certificate config to the writer.

func (Issuer) Validate

func (cfg Issuer) Validate() error

Validate checks all values are set.

type KeyMeta

type KeyMeta struct {
	Algorithm string   `toml:"algorithm"`
	Validity  Validity `toml:"validity"`
}

KeyMeta defines the key metadata.

func (KeyMeta) Validate

func (m KeyMeta) Validate() error

Validate checks all values.

type Keys

type Keys struct {
	Primary map[trc.KeyType]map[scrypto.KeyVersion]KeyMeta
	Issuer  map[cert.KeyType]map[scrypto.KeyVersion]KeyMeta
	AS      map[cert.KeyType]map[scrypto.KeyVersion]KeyMeta
}

Keys holds the key configuration.

func LoadKeys

func LoadKeys(file string) (Keys, error)

LoadKeys loads the keys from the provided file. The contents are already validated.

func (Keys) Encode

func (k Keys) Encode(w io.Writer) error

Encode writes the encoded keys config to the writer.

func (Keys) Validate

func (k Keys) Validate() error

Validate checks all key metas.

type Primary

type Primary struct {
	Attributes              trc.Attributes      `toml:"attributes"`
	IssuingKeyVersion       *scrypto.KeyVersion `toml:"issuing_key_version"`
	VotingOnlineKeyVersion  *scrypto.KeyVersion `toml:"voting_online_key_version"`
	VotingOfflineKeyVersion *scrypto.KeyVersion `toml:"voting_offline_key_version"`
}

Primary holds the primary AS configuration.

func (Primary) Validate

func (p Primary) Validate() error

Validate checks the right keys are set.

type TRC2

type TRC2 struct {
	Description       string
	Version           scrypto.Version
	BaseVersion       scrypto.Version
	VotingQuorum      uint16
	GracePeriod       util.DurWrap
	TrustResetAllowed *bool
	Votes             []addr.AS
	Validity          Validity
	PrimaryASes       map[addr.AS]Primary
}

TRC2 holds the TRC configuration. TODO(roosd): rename to TRC.

func LoadTRC

func LoadTRC(file string) (TRC2, error)

LoadTRC loads the TRC configuration from the provided file. The contents are already validated.

func (TRC2) Encode

func (cfg TRC2) Encode(w io.Writer) error

Encode writes the encoded TRC config to the writer.

func (TRC2) Validate

func (cfg TRC2) Validate() error

Validate checks all values are set.

type Validity

type Validity struct {
	NotBefore uint32       `toml:"not_before"`
	Validity  util.DurWrap `toml:"validity"`
}

Validity defines a validity period.

func (Validity) Eval

func (v Validity) Eval(notBefore time.Time) scrypto.Validity

Eval returns the validity period. The not before parameter is only used if the struct's not before field value is zero.

func (Validity) Validate

func (v Validity) Validate() error

Validate checks that the validity is set.

Jump to

Keyboard shortcuts

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