1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
package verify
import (
"errors"
"fmt"
"time"
)
var (
ErrMissingKey = errors.New("tuf: missing key")
ErrNoSignatures = errors.New("tuf: data has no signatures")
ErrInvalid = errors.New("tuf: signature verification failed")
ErrWrongMethod = errors.New("tuf: invalid signature type")
ErrWrongMetaType = errors.New("tuf: meta file has wrong type")
ErrExists = errors.New("tuf: key already in db")
ErrInvalidKey = errors.New("tuf: invalid key")
ErrInvalidRole = errors.New("tuf: invalid role")
ErrInvalidDelegatedRole = errors.New("tuf: invalid delegated role")
ErrInvalidKeyID = errors.New("tuf: invalid key id")
ErrInvalidThreshold = errors.New("tuf: invalid role threshold")
ErrMissingTargetFile = errors.New("tuf: missing previously listed targets metadata file")
)
type ErrRepeatID struct {
KeyID string
}
func (e ErrRepeatID) Error() string {
return fmt.Sprintf("tuf: duplicate key id (%s)", e.KeyID)
}
type ErrUnknownRole struct {
Role string
}
func (e ErrUnknownRole) Error() string {
return fmt.Sprintf("tuf: unknown role %q", e.Role)
}
type ErrExpired struct {
Expired time.Time
}
func (e ErrExpired) Error() string {
return fmt.Sprintf("expired at %s", e.Expired)
}
type ErrLowVersion struct {
Actual int64
Current int64
}
func (e ErrLowVersion) Error() string {
return fmt.Sprintf("version %d is lower than current version %d", e.Actual, e.Current)
}
type ErrWrongVersion struct {
Given int64
Expected int64
}
func (e ErrWrongVersion) Error() string {
return fmt.Sprintf("version %d does not match the expected version %d", e.Given, e.Expected)
}
type ErrRoleThreshold struct {
Expected int
Actual int
}
func (e ErrRoleThreshold) Error() string {
return "tuf: valid signatures did not meet threshold"
}
|