data

package
v0.0.0-...-b01a591 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyTypeEd25519 is the type of Ed25519 keys.
	KeyTypeEd25519 = KeyType("ed25519")
	// KeyTypeECDSA is the type of ECDSA keys with SHA2 and P256.
	KeyTypeECDSA = KeyType("ecdsa")
	// KeyTypeRSA is the type of RSA keys with RSASSA-PSS and SHA256.
	KeyTypeRSA = KeyType("rsa")
)
View Source
const (
	// RoleTypeRoot is The root role delegates trust to specific keys trusted for all other top-level roles used in the system.
	// https://theupdateframework.github.io/specification/latest/#root
	RoleTypeRoot = RoleType("root")
	// RoleTypeTargets is The targets role’s signature indicates which target files are trusted by clients. The targets role signs metadata that describes these files, not the actual target files themselves.
	// https://theupdateframework.github.io/specification/latest/#targets
	RoleTypeTargets = RoleType("targets")
	// RoleTypeSnapshot is The snapshot role signs a metadata file that provides information about the latest version of all targets metadata on the repository
	// https://theupdateframework.github.io/specification/latest/#snapshot
	RoleTypeSnapshot = RoleType("snapshot")
	// RoleTypeTimestamp is To prevent an adversary from replaying an out-of-date signed metadata file whose signature has not yet expired, an automated process periodically signs a timestamped statement containing the hash of the snapshot file.
	// https://theupdateframework.github.io/specification/latest/#timestamp
	RoleTypeTimestamp = RoleType("timestamp")
)

Variables

View Source
var TopLevelRoles = map[RoleType]struct{}{
	RoleTypeRoot:      {},
	RoleTypeTargets:   {},
	RoleTypeSnapshot:  {},
	RoleTypeTimestamp: {},
}

TopLevelRoles is a list of top-level roles defined in the specification https://theupdateframework.github.io/specification/latest/#roles-and-pki

Functions

func DefaultExpires

func DefaultExpires(role RoleType) time.Time

DefaultExpires returns the default expiration time for a role

Types

type Key

type Key struct {
	// Type is key type
	Type KeyType `json:"keytype"`
	// Value is key value
	Value json.RawMessage `json:"keyval"`
}

Key is common struct for signature and encryption keys

type KeyID

type KeyID data.CorrelationID

KeyID is a type of TUF server key id

func KeyIDFromString

func KeyIDFromString(s string) (KeyID, error)

KeyIDFromString returns a new KeyID from a string

func NewKeyID

func NewKeyID(repoID RepoID, roleType RoleType) KeyID

NewKeyID creates a new KeyID

func (KeyID) String

func (key KeyID) String() string

type KeyType

type KeyType string

KeyType is a string denoting a public key signature system

type PrivateKey

type PrivateKey struct {
	Key
}

PrivateKey is a private key

type PublicKey

type PublicKey struct {
	Key
	// contains filtered or unexported fields
}

PublicKey is a public key

type RepoID

type RepoID data.CorrelationID

RepoID is a type of TUF server key id

func NewRepoID

func NewRepoID() RepoID

NewRepoID returns a new RepoID

func RepoIDFromString

func RepoIDFromString(s string) (RepoID, error)

RepoIDFromString returns a new RepoID from a string

func (RepoID) String

func (r RepoID) String() string

type RepoKey

type RepoKey struct {
	// RepoID is the id of the repo
	RepoID RepoID `json:"repo_id"`
	// Role is the role of the key
	Role RoleType `json:"role"`
	// KeyID is the id of the key
	KeyID KeyID `json:"key_id"`
	// Key is the public/private key
	Key Key `json:"key"`
}

RepoKey is a key for a repo

type RoleType

type RoleType string

RoleType is top-level roles in the framework

func NewRoleType

func NewRoleType(name string) (RoleType, error)

NewRoleType returns a new RoleType from a string

Jump to

Keyboard shortcuts

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