asym

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func ConfiguredKeyType

func ConfiguredKeyType(algorithms []string) error

func GenKeyStore

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

func GenerateKeyPair

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

func GetConfiguredKeyType

func GetConfiguredKeyType() map[crypto.KeyType]string

func PrivKeyToStdKey

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

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

func PrivateKeyFromStdKey

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

PrivateKeyFromStdKey convert golang standard crypto key to our private key

func PubKeyFromStdKey

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

func PubKeyToStdKey

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

func RestorePrivateKey

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

func SignWithType

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

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

func SupportKeyType

func SupportKeyType() map[crypto.KeyType]string

func SupportedKeyType

func SupportedKeyType(typ crypto.KeyType) bool

SupportedKeyType: check if configuration algorithm supported in axiom

func Verify

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

func VerifyWithType

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

Types

type Crypto

type Crypto struct {
	Constructor         CryptoConstructor
	Verify              CryptoVerify
	UnmarshalPrivateKey CryptoUnmarshalPrivateKey
}

func GetCrypto

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

type CryptoConstructor

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

type CryptoUnmarshalPrivateKey

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

type CryptoVerify

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