secp256k1

package
v0.0.2-alpha3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSigningKeyPair

func GenerateSigningKeyPair() (publicKey, privateKey []byte)

GenerateSigningKeyPair generates secp2562k1 based keys.

func GetAddress

func GetAddress(publicKey []byte) string

GetAddress returns the hex of first 20 bytes of the Keccak256 has of public keuy

func GetEthAuthKey

func GetEthAuthKey(pub, priv string) (public, private []byte, err error)

GetEthAuthKey returns the public and private keys as byte array

func GetPrivateEthAuthKey

func GetPrivateEthAuthKey(fileName string) (key []byte, err error)

GetPrivateEthAuthKey returns the private key from the file

func GetPublicEthAuthKey

func GetPublicEthAuthKey(fileName string) (key []byte, err error)

GetPublicEthAuthKey returns the public key from the file

func Sign

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

Sign signs the message using private key

func SignEthereum

func SignEthereum(message []byte, privateKey []byte) (signature []byte, err error)

SignEthereum converts message to ethereum specific format and signs it.

func SignHash

func SignHash(data []byte) []byte

SignHash returns the hash of the data. The hash is calculated as keccak256("\x19Ethereum Signed Message:\n"${message length}${message}). for further details see https://github.com/ethereum/go-ethereum/blob/55599ee95d4151a2502465e0afc7c47bd1acba77/internal/ethapi/api.go#L404

func VerifySignature

func VerifySignature(publicKey, message, signature []byte) bool

VerifySignature verifies signature using the public key provided.

func VerifySignatureWithAddress

func VerifySignatureWithAddress(address, sigHex string, msg []byte) bool

VerifySignatureWithAddress verifies the signature using address provided

Types

This section is empty.

Jump to

Keyboard shortcuts

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