signatures

package
v0.0.0-...-02c3ccb Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWrongKeyType occurs when a key is not an valid key type.
	ErrWrongKeyType = errors.New("not an valid key type")
	// ErrPointNotOnCurve occurs when a public key is not on the curve.
	ErrPointNotOnCurve = errors.New("point is not on the P256 curve")
	// ErrMissingSig occurs when the Verify function is called with a nil signature.
	ErrMissingSig = errors.New("missing signature")
	// ErrNoPEMFound occurs when attempting to parse a non PEM data structure.
	ErrNoPEMFound = errors.New("no PEM block found")
	// ErrSign occurs whenever signature generation fails.
	ErrSign = errors.New("signature generation failed")
	// ErrVerify occurs whenever signature verification fails.
	ErrVerify = errors.New("signature verification failed")
	// ErrUnimplemented occurs when a signature scheme is not implemented.
	ErrUnimplemented = errors.New("scheme is unimplemented")
	// Rand is the PRNG reader. It can be overwritten in tests.
	Rand = rand.Reader
)

Functions

func KeyID

func KeyID(k crypto.PublicKey) (string, error)

KeyID is the hex digits of the SHA256 of the public pem.

Types

type Signer

type Signer interface {
	// Sign generates a digital signature object.
	Sign(interface{}) (*sigpb.DigitallySigned, error)
	// PublicKey returns the signer public key as tpb.PublicKey proto
	// message.
	PublicKey() (*tpb.PublicKey, error)
	// KeyID returns the ID of the associated public key.
	KeyID() string
	// Marshal marshals a signer object into a keymaster SigningKey message.
	PrivateKeyPEM() ([]byte, error)
	// PublicKeyPEM returns the PEM-formatted public key of this signer.
	PublicKeyPEM() ([]byte, error)
}

Signer represents an object that can generate signatures with a single key.

type Verifier

type Verifier interface {
	// Verify checks the digital signature associated applied to data.
	Verify(interface{}, *sigpb.DigitallySigned) error
	// PublicKey returns the verifier public key as tpb.PublicKey proto
	// message.
	PublicKey() (*tpb.PublicKey, error)
	// KeyID returns the ID of the associated public key.
	KeyID() string
	// PublicKeyPEM marshals a verifier object into a keymaster VerifyingKey message.
	PublicKeyPEM() ([]byte, error)
}

Verifier represents an object that can verify signatures with a single key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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