crypto

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCert

func ParseCert(crtPEM []byte) (*bcx509.Certificate, error)

ParseCert 解析证书

func ParsePublicKey

func ParsePublicKey(keyType crypto.KeyType, data []byte) (pubKey crypto.PublicKey, err error)

ParsePublicKey 从字节数组中解析出公钥

func SignTx

func SignTx(privatekey crypto.PrivateKey, opts *crypto.SignOpts, msg interface{}) ([]byte, error)

SignTx sign msg @Param msg messages that need to be signed @Param privatekey this variable is the private key used by the node @Param crypto.SignOpts this variable contains the conditions to be set for node signature @Return sig digital signature

func VerifyTX

func VerifyTX(sig []byte, msg interface{}, pk crypto.PublicKey, opts *crypto.SignOpts) (bool, error)

VerifyTX verify msg sign @Param msg messages that need to be signed @Param sig digital signature @Param pk this variable is the public key used by the node @Param opts this variable contains the conditions to be set for node signature @Return sig digital signature

Types

type KeyPair

type KeyPair struct {
	PrivateKey crypto.PrivateKey
	PublicKey  crypto.PublicKey
	KeyType    crypto.KeyType
}

KeyPair private key and public key pair

func GetKeyPair

func GetKeyPair(authType string, userConfig *config.UserConfig) (keyPair *KeyPair, opts *crypto.SignOpts, err error)

GetKeyPair 获取密钥对

type PubKeyEntity

type PubKeyEntity struct {
	PublicKey   crypto.PublicKey
	KeyType     crypto.KeyType
	PubKeyBytes []byte
}

PubKeyEntity pub key entity

Jump to

Keyboard shortcuts

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