keypair

package
v0.0.0-...-811092d Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: MPL-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyPair

type KeyPair struct {

	// Raw private and public key
	PrivateKey ecdsa.PrivateKey
	// Public key bytes for the private key.
	PublicKey bcpb.PublicKey
	// contains filtered or unexported fields
}

KeyPair holds a public private keypair

func FromFile

func FromFile(fpath string) (*KeyPair, error)

FromFile loads an existing keypair from the given filepath

func Generate

func Generate(curve elliptic.Curve, h hasher.Hasher) (*KeyPair, error)

Generate creates and returns a KeyPair

func New

func New(curve elliptic.Curve, h hasher.Hasher) *KeyPair

New returns a new empty keypair populated with the curve and hasher

func (KeyPair) Address

func (w KeyPair) Address() []byte

Address returns the public key address

func (KeyPair) Algorithm

func (w KeyPair) Algorithm() []byte

Algorithm returns the keypair algorithm

func (KeyPair) Save

func (w KeyPair) Save(fpath string) error

Save x509 marshals the key and writes it to the given path

func (KeyPair) Sign

func (w KeyPair) Sign(digest bcpb.Digest) ([]byte, error)

Sign signs the digest and returns the signature

func (KeyPair) VerifySignature

func (w KeyPair) VerifySignature(digest bcpb.Digest, signature []byte) bool

VerifySignature verifies the signature for te digest

Jump to

Keyboard shortcuts

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