signatures

package
v0.0.0-...-9be813a Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package signatures signs and verifies data. This package will be deprecated soon.

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 keyspb.PublicKey proto
	// message.
	PublicKey() (*keyspb.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 keyspb.PublicKey proto
	// message.
	PublicKey() (*keyspb.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
Package rsa implements signature generation and verification using RSA.
Package rsa implements signature generation and verification using RSA.

Jump to

Keyboard shortcuts

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