asym

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: LGPL-3.0 Imports: 15 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CryptoM = make(map[crypto.KeyType]*Crypto)

Functions

func ConfiguredKeyType added in v1.20.0

func ConfiguredKeyType(algorithms []string) error

func GenKeyStore added in v1.0.1

func GenKeyStore(priv crypto.PrivateKey, password string) (*crypto.KeyStore, error)

func GenerateKeyPair added in v1.0.1

func GenerateKeyPair(opt crypto.KeyType) (crypto.PrivateKey, error)

func GetConfiguredKeyType added in v1.20.0

func GetConfiguredKeyType() map[crypto.KeyType]string

func PrivKeyToStdKey added in v1.0.1

func PrivKeyToStdKey(priv crypto.PrivateKey) (ecdsa2.PrivateKey, error)

PrivKeyToStdKey convert our crypto private key to golang standard ecdsa private key

func PrivateKeyFromStdKey added in v1.0.1

func PrivateKeyFromStdKey(priv crypto2.PrivateKey) (crypto.PrivateKey, error)

PrivateKeyFromStdKey convert golang standard crypto key to our private key

func PubKeyFromStdKey added in v1.0.1

func PubKeyFromStdKey(pub crypto2.PublicKey) (crypto.PublicKey, error)

func PubKeyToStdKey added in v1.0.1

func PubKeyToStdKey(pub crypto.PublicKey) (crypto2.PublicKey, error)

func RegisterCrypto added in v1.20.0

func RestorePrivateKey added in v1.0.1

func RestorePrivateKey(keyFilePath, password string) (crypto.PrivateKey, error)

func SignWithType added in v1.20.0

func SignWithType(privKey crypto.PrivateKey, digest []byte) ([]byte, error)

Sign signs digest using key k and add key type flag in the beginning.

func StorePrivateKey added in v1.0.1

func StorePrivateKey(priv crypto.PrivateKey, keyFilePath, password string) error

func SupportKeyType added in v1.20.0

func SupportKeyType() map[crypto.KeyType]string

func SupportedKeyType added in v1.20.0

func SupportedKeyType(typ crypto.KeyType) bool

SupportedKeyType: check if configuration algorithm supported in bitxhub

func Verify

func Verify(opt crypto.KeyType, sig, digest []byte, from types.Address) (bool, error)

func VerifyWithType added in v1.20.0

func VerifyWithType(sig, digest []byte, from types.Address) (bool, error)

Types

type Crypto added in v1.20.0

type Crypto struct {
	Constructor         CryptoConstructor
	Verify              CryptoVerify
	UnmarshalPrivateKey CryptoUnmarshalPrivateKey
}

func GetCrypto added in v1.20.0

func GetCrypto(typ crypto.KeyType) (*Crypto, error)

type CryptoConstructor added in v1.20.0

type CryptoConstructor func(opt crypto.KeyType) (crypto.PrivateKey, error)

type CryptoUnmarshalPrivateKey added in v1.20.0

type CryptoUnmarshalPrivateKey func(data []byte, opt crypto.KeyType) (crypto.PrivateKey, error)

type CryptoVerify added in v1.20.0

type CryptoVerify func(opt crypto.KeyType, sig, digest []byte, from types.Address) (bool, error)

Directories

Path Synopsis
secp256k1
Package secp256k1 wraps the bitcoin secp256k1 C library.
Package secp256k1 wraps the bitcoin secp256k1 C library.

Jump to

Keyboard shortcuts

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