signer

package
v1.4.0-RC1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPublicKey = errors.New("invalid public key")

Functions

func ParsePublicKeyFile added in v0.9.0

func ParsePublicKeyFile(filePath string) (*ecdsa.PublicKey, error)

func UnmarshalKey added in v0.9.0

func UnmarshalKey(publicKey []byte) (*ecdsa.PublicKey, error)

func Verify

func Verify(payload []byte, signature []byte, publicKey *ecdsa.PublicKey) (bool, error)

verify verifies a signed payload

Types

type Signer

type Signer interface {
	Sign(payload []byte) (signature []byte, publicKey []byte, err error)
}

func NewSigner

func NewSigner(privateKeyPath string) (Signer, error)

NewSigner returns a signer object. It requires a private key file path. To generate a valid key use openssl tool. Ex: openssl ecparam -name prime256v1 -genkey -noout -out ec.key

func NewSignerFromPKey

func NewSignerFromPKey(r io.Reader, pk *ecdsa.PrivateKey) Signer

NewSignerFromPKey returns a signer from a io.Reader and a *ecdsa.PrivateKey.

Jump to

Keyboard shortcuts

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