Documentation ¶
Overview ¶
Package tuf defines the core TUF logic around manipulating a repo.
Index ¶
- type ErrLocalRootExpired
- type ErrMetaExpired
- type ErrNotLoaded
- type ErrSigVerifyFail
- type Repo
- func (tr *Repo) AddBaseKeys(role string, keys ...data.PublicKey) error
- func (tr *Repo) AddTargets(role string, targets data.Files) (data.Files, error)
- func (tr Repo) FindTarget(path string) *data.FileMeta
- func (tr *Repo) InitRepo(consistent bool) error
- func (tr *Repo) InitRoot(consistent bool) error
- func (tr *Repo) InitSnapshot() error
- func (tr *Repo) InitTargets() error
- func (tr *Repo) InitTimestamp() error
- func (tr *Repo) RemoveBaseKeys(role string, keyIDs ...string) error
- func (tr *Repo) RemoveTargets(role string, targets ...string) error
- func (tr *Repo) ReplaceBaseKeys(role string, keys ...data.PublicKey) error
- func (tr *Repo) SetRoot(s *data.SignedRoot) error
- func (tr *Repo) SetSnapshot(s *data.SignedSnapshot) error
- func (tr *Repo) SetTargets(role string, s *data.SignedTargets) error
- func (tr *Repo) SetTimestamp(s *data.SignedTimestamp) error
- func (tr *Repo) SignRoot(expires time.Time, cryptoService signed.CryptoService) (*data.Signed, error)
- func (tr *Repo) SignSnapshot(expires time.Time, cryptoService signed.CryptoService) (*data.Signed, error)
- func (tr *Repo) SignTargets(role string, expires time.Time, cryptoService signed.CryptoService) (*data.Signed, error)
- func (tr *Repo) SignTimestamp(expires time.Time, cryptoService signed.CryptoService) (*data.Signed, error)
- func (tr Repo) TargetDelegations(role, path, pathHex string) []*data.Role
- func (tr Repo) TargetMeta(role, path string) *data.FileMeta
- func (tr *Repo) UpdateDelegations(role *data.Role, keys []data.Key, before string) error
- func (tr *Repo) UpdateSnapshot(role string, s *data.Signed) error
- func (tr *Repo) UpdateTimestamp(s *data.Signed) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrLocalRootExpired ¶
type ErrLocalRootExpired struct{}
ErrLocalRootExpired - the local root file is out of date
func (ErrLocalRootExpired) Error ¶
func (e ErrLocalRootExpired) Error() string
type ErrMetaExpired ¶
type ErrMetaExpired struct{}
ErrMetaExpired - metadata file has expired
func (ErrMetaExpired) Error ¶
func (e ErrMetaExpired) Error() string
type ErrNotLoaded ¶
type ErrNotLoaded struct {
// contains filtered or unexported fields
}
ErrNotLoaded - attempted to access data that has not been loaded into the repo
func (ErrNotLoaded) Error ¶
func (err ErrNotLoaded) Error() string
type ErrSigVerifyFail ¶
type ErrSigVerifyFail struct{}
ErrSigVerifyFail - signature verification failed
func (ErrSigVerifyFail) Error ¶
func (e ErrSigVerifyFail) Error() string
type Repo ¶
type Repo struct { Root *data.SignedRoot Targets map[string]*data.SignedTargets Snapshot *data.SignedSnapshot Timestamp *data.SignedTimestamp // contains filtered or unexported fields }
Repo is an in memory representation of the TUF Repo. It operates at the data.Signed level, accepting and producing data.Signed objects. Users of a Repo are responsible for fetching raw JSON and using the Set* functions to populate the Repo instance.
func NewRepo ¶
func NewRepo(keysDB *keys.KeyDB, cryptoService signed.CryptoService) *Repo
NewRepo initializes a Repo instance with a keysDB and a signer. If the Repo will only be used for reading, the signer should be nil.
func (*Repo) AddBaseKeys ¶
AddBaseKeys is used to add keys to the role in root.json
func (*Repo) AddTargets ¶
AddTargets will attempt to add the given targets specifically to the directed role. If the user does not have the signing keys for the role the function will return an error and the full slice of targets.
func (Repo) FindTarget ¶
FindTarget attempts to find the target represented by the given path by starting at the top targets file and traversing appropriate delegations until the first entry is found or it runs out of locations to search. N.B. Multiple entries may exist in different delegated roles
for the same target. Only the first one encountered is returned.
func (*Repo) InitRepo ¶
InitRepo creates the base files for a repo. It inspects data.ValidRoles and data.ValidTypes to determine what the role names and filename should be. It also relies on the keysDB having already been populated with the keys and roles.
func (*Repo) InitRoot ¶
InitRoot initializes an empty root file with the 4 core roles based on the current content of th ekey db
func (*Repo) InitSnapshot ¶
InitSnapshot initializes a snapshot based on the current root and targets
func (*Repo) InitTargets ¶
InitTargets initializes an empty targets
func (*Repo) InitTimestamp ¶
InitTimestamp initializes a timestamp based on the current snapshot
func (*Repo) RemoveBaseKeys ¶
RemoveBaseKeys is used to remove keys from the roles in root.json
func (*Repo) RemoveTargets ¶
RemoveTargets removes the given target (paths) from the given target role (delegation)
func (*Repo) ReplaceBaseKeys ¶
ReplaceBaseKeys is used to replace all keys for the given role with the new keys
func (*Repo) SetRoot ¶
func (tr *Repo) SetRoot(s *data.SignedRoot) error
SetRoot parses the Signed object into a SignedRoot object, sets the keys and roles in the KeyDB, and sets the Repo.Root field to the SignedRoot object.
func (*Repo) SetSnapshot ¶
func (tr *Repo) SetSnapshot(s *data.SignedSnapshot) error
SetSnapshot parses the Signed object into a SignedSnapshots object and sets the Repo.Snapshot field.
func (*Repo) SetTargets ¶
func (tr *Repo) SetTargets(role string, s *data.SignedTargets) error
SetTargets parses the Signed object into a SignedTargets object, reads the delegated roles and keys into the KeyDB, and sets the SignedTargets object agaist the role in the Repo.Targets map.
func (*Repo) SetTimestamp ¶
func (tr *Repo) SetTimestamp(s *data.SignedTimestamp) error
SetTimestamp parses the Signed object into a SignedTimestamp object and sets the Repo.Timestamp field.
func (*Repo) SignRoot ¶
func (tr *Repo) SignRoot(expires time.Time, cryptoService signed.CryptoService) (*data.Signed, error)
SignRoot signs the root
func (*Repo) SignSnapshot ¶
func (tr *Repo) SignSnapshot(expires time.Time, cryptoService signed.CryptoService) (*data.Signed, error)
SignSnapshot updates the snapshot based on the current targets and root then signs it
func (*Repo) SignTargets ¶
func (tr *Repo) SignTargets(role string, expires time.Time, cryptoService signed.CryptoService) (*data.Signed, error)
SignTargets signs the targets file for the given top level or delegated targets role
func (*Repo) SignTimestamp ¶
func (tr *Repo) SignTimestamp(expires time.Time, cryptoService signed.CryptoService) (*data.Signed, error)
SignTimestamp updates the timestamp based on the current snapshot then signs it
func (Repo) TargetDelegations ¶
TargetDelegations returns a slice of Roles that are valid publishers for the target path provided.
func (Repo) TargetMeta ¶
TargetMeta returns the FileMeta entry for the given path in the targets file associated with the given role. This may be nil if the target isn't found in the targets file.
func (*Repo) UpdateDelegations ¶
UpdateDelegations updates the appropriate delegations, either adding a new delegation or updating an existing one. If keys are provided, the IDs will be added to the role (if they do not exist there already), and the keys will be added to the targets file. The "before" argument specifies another role which this new role will be added in front of (i.e. higher priority) in the delegation list. An empty before string indicates to add the role to the end of the delegation list. A new, empty, targets file will be created for the new role.
func (*Repo) UpdateSnapshot ¶
UpdateSnapshot updates the FileMeta for the given role based on the Signed object
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/github.com/agl/ed25519
Package ed25519 implements the Ed25519 signature algorithm.
|
Package ed25519 implements the Ed25519 signature algorithm. |
_workspace/src/github.com/agl/ed25519/edwards25519
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519.
|
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519. |
_workspace/src/github.com/docker/notary/pkg/passphrase
Package passphrase is a utility function for managing passphrase for TUF and Notary keys.
|
Package passphrase is a utility function for managing passphrase for TUF and Notary keys. |
_workspace/src/github.com/google/gofuzz
Package fuzz is a library for populating go objects with random values.
|
Package fuzz is a library for populating go objects with random values. |
_workspace/src/github.com/jfrazelle/go/canonical/json
Package json implements encoding and decoding of JSON objects as defined in RFC 4627.
|
Package json implements encoding and decoding of JSON objects as defined in RFC 4627. |
_workspace/src/github.com/mattn/go-sqlite3
Package sqlite3 provides interface to SQLite3 databases.
|
Package sqlite3 provides interface to SQLite3 databases. |
_workspace/src/github.com/stretchr/testify/assert
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
|
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. |
_workspace/src/golang.org/x/crypto/nacl/secretbox
Package secretbox encrypts and authenticates small messages.
|
Package secretbox encrypts and authenticates small messages. |
_workspace/src/golang.org/x/crypto/pbkdf2
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
|
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0. |
_workspace/src/golang.org/x/crypto/poly1305
Package poly1305 implements Poly1305 one-time message authentication code as specified in http://cr.yp.to/mac/poly1305-20050329.pdf.
|
Package poly1305 implements Poly1305 one-time message authentication code as specified in http://cr.yp.to/mac/poly1305-20050329.pdf. |
_workspace/src/golang.org/x/crypto/salsa20/salsa
Package salsa provides low-level access to functions in the Salsa family.
|
Package salsa provides low-level access to functions in the Salsa family. |
_workspace/src/golang.org/x/crypto/scrypt
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (http://www.tarsnap.com/scrypt/scrypt.pdf).
|
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (http://www.tarsnap.com/scrypt/scrypt.pdf). |
Package encrypted provides a simple, secure system for encrypting data symmetrically with a passphrase.
|
Package encrypted provides a simple, secure system for encrypting data symmetrically with a passphrase. |