elliptic

package
v0.0.0-...-d02f37a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Nist256p1

func Nist256p1() slip10.Curve

Nist256p1 returns a slip10.Curve which implements NIST P-256 (FIPS 186-3, section D.2.3).

func Secp256k1

func Secp256k1() slip10.Curve

Secp256k1 returns a slip10.Curve which implements secp256k1 (SEC 2, section 2.4.1).

Types

type Curve

type Curve struct {
	elliptic.Curve
}

Curve is an abstract implementation of slip10.Curve based on elliptic.Curve.

func (Curve) HmacKey

func (Curve) HmacKey() []byte

HmacKey must be overridden in any valid implementation.

func (Curve) Name

func (c Curve) Name() string

Name returns the canonical name of the curve.

func (Curve) NewPrivateKey

func (c Curve) NewPrivateKey(buf []byte) (slip10.Key, error)

NewPrivateKey creates a PrivateKey from buf. When buf does not correspond to a valid private key, an error is returned.

type PrivateKey

type PrivateKey struct {
	K     *big.Int
	Curve elliptic.Curve
}

PrivateKey implements slip10.Key and represents a private key for elliptic.Curve.

func (*PrivateKey) Bytes

func (p *PrivateKey) Bytes() []byte

Bytes returns the SLIP-10 serialization of the key.

func (*PrivateKey) ECDSAPrivateKey

func (p *PrivateKey) ECDSAPrivateKey() *ecdsa.PrivateKey

ECDSAPrivateKey returns the corresponding ecdsa.PrivateKey.

func (*PrivateKey) IsPrivate

func (*PrivateKey) IsPrivate() bool

IsPrivate always returns true.

func (*PrivateKey) Public

func (p *PrivateKey) Public() slip10.Key

Public returns the corresponding PublicKey.

func (*PrivateKey) Shift

func (p *PrivateKey) Shift(buf []byte) (slip10.Key, error)

Shift derives a new PrivateKey using the provided additive shift. It returns ErrInvalidKey if the shift leads to an invalid key.

func (*PrivateKey) String

func (p *PrivateKey) String() string

type PublicKey

type PublicKey struct {
	X, Y  *big.Int
	Curve elliptic.Curve
}

PublicKey implements slip10.Key and represents a public key for elliptic.Curve.

func (*PublicKey) Bytes

func (p *PublicKey) Bytes() []byte

Bytes returns the SLIP-10 serialization of the key.

func (*PublicKey) ECDSAPublicKey

func (p *PublicKey) ECDSAPublicKey() *ecdsa.PublicKey

ECDSAPublicKey returns the corresponding ecdsa.PublicKey.

func (*PublicKey) IsPrivate

func (*PublicKey) IsPrivate() bool

IsPrivate always returns false.

func (*PublicKey) Public

func (p *PublicKey) Public() slip10.Key

Public returns a reference to itself.

func (*PublicKey) Shift

func (p *PublicKey) Shift(bytes []byte) (slip10.Key, error)

Shift derives a new PublicKey using the provided additive shift. It returns ErrInvalidKey if the shift leads to an invalid key.

func (*PublicKey) String

func (p *PublicKey) String() string

Directories

Path Synopsis
internal
btccurve
Package btccurve implements the secp256k1 curve used by Bitcoin.
Package btccurve implements the secp256k1 curve used by Bitcoin.

Jump to

Keyboard shortcuts

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