signed

package
v0.0.0-...-03904d5 Latest Latest
Warning

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

Go to latest
Published: May 11, 2015 License: BSD-3-Clause Imports: 16 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{},
	"rsa":     RSAVerifier{},
}

Verifiers serves as a map of all verifiers available on the system and can be injected into a verificationService. For testing and configuration purposes, it will not be used by default.

Functions

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 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 CryptoService

type CryptoService interface {
	SigningService
	KeyService
}

type Ed25519

type Ed25519 struct {
	// contains filtered or unexported fields
}

Ed25519 implements a simple in memory keystore and trust service

func NewEd25519

func NewEd25519() *Ed25519

func (*Ed25519) Create

func (trust *Ed25519) Create() (*keys.PublicKey, error)

func (*Ed25519) PublicKeys

func (trust *Ed25519) PublicKeys(keyIDs ...string) (map[string]*keys.PublicKey, error)

func (*Ed25519) RemoveKey

func (trust *Ed25519) RemoveKey(keyID string)

func (*Ed25519) Sign

func (trust *Ed25519) Sign(keyIDs []string, toSign []byte) ([]data.Signature, error)

type Ed25519Verifier

type Ed25519Verifier struct{}

func (Ed25519Verifier) Verify

func (v Ed25519Verifier) Verify(key *data.Key, sig []byte, msg []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 KeyService

type KeyService interface {
	Create() (*keys.PublicKey, error)
	PublicKeys(keyIDs ...string) (map[string]*keys.PublicKey, error)
}

type RSAVerifier

type RSAVerifier struct{}

func (RSAVerifier) Verify

func (v RSAVerifier) Verify(key *data.Key, sig []byte, msg []byte) error

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer encapsulates a signing service with some convenience methods to interface between TUF keys and the generic service interface

func NewSigner

func NewSigner(service CryptoService) *Signer

func (*Signer) Create

func (signer *Signer) Create() (*keys.PublicKey, error)

func (*Signer) PublicKeys

func (signer *Signer) PublicKeys(keyIDs ...string) (map[string]*keys.PublicKey, error)

func (*Signer) Sign

func (signer *Signer) Sign(s *data.Signed, keys ...*keys.PublicKey) error

Sign takes a data.Signed and a key, calculated and adds the signature to the data.Signed

type SigningService

type SigningService interface {
	Sign(keyIDs []string, data []byte) ([]data.Signature, error)
}

type Verifier

type Verifier interface {
	Verify(key *data.Key, sig []byte, msg []byte) error
}

Jump to

Keyboard shortcuts

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