secp256k1

package
v0.0.0-...-72bc2f9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrUnusableSeed describes an error in which the provided seed is not
	// usable due to the derived key falling outside of the valid range for
	// secp256k1 private keys.  This error indicates the caller must choose
	// another seed.
	ErrUnusableSeed = errors.New("unusable seed")
)

Functions

func PublicKeyFromBytes

func PublicKeyFromBytes(keyBytes []byte) (crypto.PublicKey, error)

PublicKeyFromBytes create a public key from []byte

Types

type PrivateKey

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

PrivateKey based on the secp256k1 curve.

func GenerateKey

func GenerateKey(rand io.Reader) (*PrivateKey, error)

func PrivateKeyFromBytes

func PrivateKeyFromBytes(pk []byte) (*PrivateKey, error)

PrivateKeyFromBytes get a private key from []byte.

func PrivateKeyFromECDSA

func PrivateKeyFromECDSA(pk ecdsa.PrivateKey) PrivateKey

PrivateKeyFromECDSA get a private key from an ecdsa.PrivateKey.

func (PrivateKey) Bytes

func (pk PrivateKey) Bytes() []byte

Bytes returns the byte representation of the private key.

func (PrivateKey) ECDSA

func (pk PrivateKey) ECDSA() (*ecdsa.PrivateKey, error)

ECDSA returns an ECDSA representation of the private key.

func (PrivateKey) ECIES

func (pk PrivateKey) ECIES() *ecies.PrivateKey

ECIES returns an ECIES representation of the private key.

func (PrivateKey) PublicKey

func (pk PrivateKey) PublicKey() crypto.PublicKey

PublicKey return the public key that is derived from the private key.

func (PrivateKey) Sign

func (pk PrivateKey) Sign(message []byte) (signature []byte, err error)

TODO: remove this sign function Sign signs the message with the private key and returns the signature.

type PublicKey

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

PublicKey based on the secp256k1 curve

func (PublicKey) Bytes

func (pk PublicKey) Bytes() []byte

Bytes returns the byte representation of the public key

func (PublicKey) ECDSA

func (pk PublicKey) ECDSA() *ecdsa.PublicKey

func (PublicKey) ECIES

func (pk PublicKey) ECIES() (*ecies.PublicKey, error)

ECIES returns an ECIES representation of the public key.

func (PublicKey) UncompressedBytes

func (pk PublicKey) UncompressedBytes() []byte

func (PublicKey) Verify

func (pk PublicKey) Verify(message, sig []byte) bool

Verify verifies whether sig is a valid signature of message.

Directories

Path Synopsis
Package secp256k1test contains keys that are used to ease testing of Mailchain functionality.
Package secp256k1test contains keys that are used to ease testing of Mailchain functionality.

Jump to

Keyboard shortcuts

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