crypto

package
v0.0.0-...-c073115 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers all the necessary types with amino for the given codec.

Types

type PrivKeySecp256k1

type PrivKeySecp256k1 ecdsa.PrivateKey

PrivKeySecp256k1 defines a type alias for an ecdsa.PrivateKey that implements Tendermint's PrivateKey interface.

func GenerateKey

func GenerateKey() (PrivKeySecp256k1, error)

GenerateKey generates a new random private key. It returns an error upon failure.

func (PrivKeySecp256k1) Bytes

func (privkey PrivKeySecp256k1) Bytes() []byte

Bytes returns the raw ECDSA private key bytes.

func (PrivKeySecp256k1) Equals

func (privkey PrivKeySecp256k1) Equals(other tmcrypto.PrivKey) bool

Equals returns true if two ECDSA private keys are equal and false otherwise.

func (PrivKeySecp256k1) PubKey

func (privkey PrivKeySecp256k1) PubKey() tmcrypto.PubKey

PubKey returns the ECDSA private key's public key.

func (PrivKeySecp256k1) Sign

func (privkey PrivKeySecp256k1) Sign(msg []byte) ([]byte, error)

Sign creates a recoverable ECDSA signature on the secp256k1 curve over the Keccak256 hash of the provided message. The produced signature is 65 bytes where the last byte contains the recovery ID.

func (PrivKeySecp256k1) ToECDSA

func (privkey PrivKeySecp256k1) ToECDSA() *ecdsa.PrivateKey

ToECDSA returns the ECDSA private key as a reference to ecdsa.PrivateKey type.

type PubKeySecp256k1

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

PubKeySecp256k1 defines a type alias for an ecdsa.PublicKey that implements Tendermint's PubKey interface.

func (PubKeySecp256k1) Address

func (key PubKeySecp256k1) Address() tmcrypto.Address

Address returns the address of the ECDSA public key.

func (PubKeySecp256k1) Bytes

func (key PubKeySecp256k1) Bytes() []byte

Bytes returns the raw bytes of the ECDSA public key.

func (PubKeySecp256k1) Equals

func (key PubKeySecp256k1) Equals(other tmcrypto.PubKey) bool

Equals returns true if two ECDSA public keys are equal and false otherwise.

func (PubKeySecp256k1) VerifyBytes

func (key PubKeySecp256k1) VerifyBytes(msg []byte, sig []byte) bool

VerifyBytes verifies that the ECDSA public key created a given signature over the provided message. It will calculate the Keccak256 hash of the message prior to verification.

Jump to

Keyboard shortcuts

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