signed

package
v0.0.0-...-82ed859 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2016 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
	ErrUnknownRole   = errors.New("tuf: unknown role")
	ErrRoleThreshold = errors.New("tuf: valid signatures did not meet threshold")
	ErrWrongType     = errors.New("tuf: meta file has wrong type")
)
View Source
var IsExpired = func(t time.Time) bool {
	return t.Sub(time.Now()) <= 0
}
View Source
var Verifiers = map[string]Verifier{
	"ed25519": Ed25519Verifier{},
}

Verifiers is used to map algorithm names to Verifier instances.

Functions

func Marshal

func Marshal(v interface{}, keys ...*data.Key) (*data.Signed, error)

func RegisterVerifier

func RegisterVerifier(name string, v Verifier)

RegisterVerifier provides a convenience function for init() functions to register additional verifiers or replace existing ones.

func Sign

func Sign(s *data.Signed, k *data.Key)

func Unmarshal

func Unmarshal(b []byte, v interface{}, role string, minVersion int, db *keys.DB) error

func UnmarshalTrusted

func UnmarshalTrusted(b []byte, v interface{}, role string, db *keys.DB) error

func Verify

func Verify(s *data.Signed, role string, minVersion int, db *keys.DB) error

func VerifySignatures

func VerifySignatures(s *data.Signed, role string, db *keys.DB) error

Types

type Ed25519Verifier

type Ed25519Verifier struct{}

Ed25519Verifier is an implementation of a Verifier that verifies ed25519 signatures

func (Ed25519Verifier) Verify

func (v Ed25519Verifier) Verify(key []byte, msg []byte, sig []byte) error

type ErrExpired

type ErrExpired struct {
	Expired time.Time
}

func (ErrExpired) Error

func (e ErrExpired) Error() string

type ErrLowVersion

type ErrLowVersion struct {
	Actual  int
	Current int
}

func (ErrLowVersion) Error

func (e ErrLowVersion) Error() string

type RSAVerifier

type RSAVerifier struct{}

RSAVerifier is an implementation of a Verifier that verifies RSA signatures. N.B. Currently not covered by unit tests, use at your own risk.

func (RSAVerifier) Verify

func (v RSAVerifier) Verify(key []byte, msg []byte, sig []byte) error

type Verifier

type Verifier interface {
	// Verify takes a key, message and signature, all as byte slices,
	// and determines whether the signature is valid for the given
	// key and message.
	Verify(key []byte, msg []byte, sig []byte) error
}

Verifier describes the verification interface. Implement this interface to add additional verifiers to go-tuf.

Jump to

Keyboard shortcuts

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