crypto

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: LGPL-2.1 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bech32AddressFromPrivateKeyEDD

func Bech32AddressFromPrivateKeyEDD(privateKey []byte) string

func DecryptPrivateKey added in v1.2.0

func DecryptPrivateKey(encryptedKey []byte, password string, salt []byte) ([]byte, error)

Decrypts the private key using a password and the original salt

func EncryptPrivateKey added in v1.2.0

func EncryptPrivateKey(privateKey []byte, password string) (cypher []byte, salt []byte, err error)

Encrypts a private key using a password and scrypt

func EthMessage added in v1.2.0

func EthMessage(message []byte) []byte

func GenerateTLSConfig added in v1.2.16

func GenerateTLSConfig(keyPEM []byte, certPEM []byte) (*tls.Config, error)

func GetPrivateKeyFromKeyStore added in v1.2.0

func GetPrivateKeyFromKeyStore(ksPath string, account accounts.Account, password string) ([]byte, error)

func GetPublicKeyECC

func GetPublicKeyECC(privKey string) string

func GetPublicKeyEDD

func GetPublicKeyEDD(privKey []byte) [32]byte

func GetPublicKeySECP

func GetPublicKeySECP(privateKey []byte) (string, []byte)

func GetSignerECC

func GetSignerECC(message *[]byte, signature *string) (string, error)

func HashMessageEth added in v1.2.0

func HashMessageEth(message []byte) []byte

func Keccak256Hash

func Keccak256Hash(message []byte) []byte

func PrivateKeyFromString added in v1.2.0

func PrivateKeyFromString(privKey string) (*ecdsa.PrivateKey, error)

func Sha256

func Sha256(s []byte) []byte

func SignECC

func SignECC(message []byte, privKey string) ([]byte, string)

func SignEDD

func SignEDD(message []byte, privKey []byte) ([]byte, string)

func SignSECP

func SignSECP(message []byte, privateKeyByte []byte) (signatureByte []byte, signatureString string)

func ToBech32Address

func ToBech32Address(publicKey []byte, prefix string) string

func ToBtcecSignature

func ToBtcecSignature(sigHex string) (*[]byte, error)

30440220 8ee622395fd93884b700406e9f297914b1934d31cece58992897901d6f1930210220296c724c79c5875930fad760f49073b99bf0514d43d2499c0982 8ee622395fd93884b700406e9f297914b1934d31cece58992897901d6f193021296c724c79c5875930fad760f49073b99bf0514d43d2499c0982 6169eb06fe82

func ValidateCert added in v1.2.16

func ValidateCert(cert []byte) error

func VerifySignatureAmino

func VerifySignatureAmino(signedData string, signature []byte, account string, pubKey []byte) (bool, error)

func VerifySignatureECC

func VerifySignatureECC(signer string, message *[]byte, signature string) bool

func VerifySignatureEDD

func VerifySignatureEDD(signer []byte, message *[]byte, signature []byte) (bool, error)

func VerifySignatureSECP

func VerifySignatureSECP(publicKeyBytes []byte, message []byte, signatureByte []byte) (bool, error)

Types

type CertData added in v1.2.16

type CertData struct {
	Cert string `json:"cert"`
	Key  string `json:"key"`
}

func GenerateCertData added in v1.2.16

func GenerateCertData() (cd *CertData, err error)

Generate a self-signed certificate and save it to files

func GetOrGenerateCert added in v1.2.16

func GetOrGenerateCert(ctx *context.Context) *CertData

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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