ecdsa

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package ECDSA implements soominhyunwoo-SDK compatible ECDSA public and private key. The keys can be serialized.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrivKey

type PrivKey struct {
	ecdsa.PrivateKey
}

func GenPrivKey

func GenPrivKey(curve elliptic.Curve) (PrivKey, error)

GenPrivKey generates a new secp256r1 private key. It uses operating system randomness.

func (*PrivKey) Bytes

func (sk *PrivKey) Bytes() []byte

Bytes serialize the private key using big-endian.

func (*PrivKey) MarshalTo

func (sk *PrivKey) MarshalTo(dAtA []byte) (int, error)

MarshalTo implements proto.Marshaler interface.

func (*PrivKey) PubKey

func (sk *PrivKey) PubKey() PubKey

PubKey returns ECDSA public key associated with this private key.

func (*PrivKey) Sign

func (sk *PrivKey) Sign(msg []byte) ([]byte, error)

Sign hashes and signs the message usign ECDSA. Implements SDK PrivKey interface.

func (*PrivKey) String

func (sk *PrivKey) String(name string) string

String returns a string representation of the public key based on the curveName.

func (*PrivKey) Unmarshal

func (sk *PrivKey) Unmarshal(bz []byte, curve elliptic.Curve, expectedSize int) error

Unmarshal implements proto.Marshaler interface.

type PubKey

type PubKey struct {
	ecdsa.PublicKey
	// contains filtered or unexported fields
}

func (*PubKey) Address

func (pk *PubKey) Address(protoName string) tmcrypto.Address

Address gets the address associated with a pubkey. If no address exists, it returns a newly created ADR-28 address for ECDSA keys. protoName is a concrete proto structure id.

func (*PubKey) Bytes

func (pk *PubKey) Bytes() []byte

Bytes returns the byte representation of the public key using a compressed form specified in section 4.3.6 of ANSI X9.62 with first byte being the curve type.

func (*PubKey) MarshalTo

func (pk *PubKey) MarshalTo(dAtA []byte) (int, error)

MarshalTo implements proto.Marshaler interface.

func (*PubKey) String

func (pk *PubKey) String(curveName string) string

String returns a string representation of the public key based on the curveName.

func (*PubKey) Unmarshal

func (pk *PubKey) Unmarshal(bz []byte, curve elliptic.Curve, expectedSize int) error

Unmarshal implements proto.Marshaler interface.

func (*PubKey) VerifySignature

func (pk *PubKey) VerifySignature(msg []byte, sig []byte) bool

VerifySignature checks if sig is a valid ECDSA signature for msg.

Jump to

Keyboard shortcuts

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