eckey

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EcKey

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

用于管理公私钥的结构 依赖于ethereum的基础包,但本结构总的数据都是golang基础包中的

func FromPriKeyBytes

func FromPriKeyBytes(priBytes []byte) (*EcKey, error)

根据私钥字符串,还原EcKey

func FromPubKeyBytes

func FromPubKeyBytes(pubBytes []byte) (*EcKey, error)

根据公钥还原eckey,可以进行签名验证及数据解密

func NewEcKey

func NewEcKey() (*EcKey, error)

随机生成新的公私钥对

func (*EcKey) Decrypt

func (e *EcKey) Decrypt(in []byte) []byte

使用私钥解密以公钥加密的数据

func (*EcKey) Encrypt

func (e *EcKey) Encrypt(data []byte) []byte

使用公钥加密数据

func (*EcKey) GetPriKeyBytes

func (e *EcKey) GetPriKeyBytes() []byte

获取私钥字节数组

func (*EcKey) GetPriKeyHex

func (e *EcKey) GetPriKeyHex() string

获取hex编码后的私钥

func (*EcKey) GetPubKeyBytes

func (e *EcKey) GetPubKeyBytes(compressed bool) []byte

获取公钥的字节数组 compressed代表是否压缩,true为压缩,false为不压缩

func (*EcKey) GetPubKeyHex

func (e *EcKey) GetPubKeyHex(compressed bool) string

获取hex编码后的公钥 compressed代表是否压缩,true为压缩,false为不压缩

func (*EcKey) IsPriKeyNil

func (e *EcKey) IsPriKeyNil() bool

判断结构中的私钥是否为空

func (*EcKey) Sign

func (e *EcKey) Sign(data []byte) ([]byte, error)

func (*EcKey) Verify

func (e *EcKey) Verify(data, signature []byte) bool

Jump to

Keyboard shortcuts

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