crypto

package
v0.0.0-...-59ccd6a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(privKey *btcec.PrivateKey, data []byte) ([]byte, error)

Decrypt decrypts data using a secp256k1 private key (ECIES)

func DecryptWithAES256

func DecryptWithAES256(secretKey, nonce, ciphertext []byte) ([]byte, error)

DecryptWithAES256 decrypts data using a AES256 cryptography.

func DeriveSharedKey

func DeriveSharedKey(priv *btcec.PrivateKey, pub *btcec.PublicKey, kdf func([]byte) []byte) []byte

DeriveSharedKey derives a shared key (which can be used for asymmetric encryption) using a specified KDF (Key Derivation Function) from a shared secret generated by Diffie-Hellman key exchange (ECDH).

func Encrypt

func Encrypt(pubKey *btcec.PublicKey, data []byte) ([]byte, error)

Encrypt encrypts data using a secp256k1 public key (ECIES)

func EncryptWithAES256

func EncryptWithAES256(secretKey, nonce, data []byte) ([]byte, error)

EncryptWithAES256 encrypts data using a AES256 cryptography.

func GeneratePrivateKeyFromMnemonic

func GeneratePrivateKeyFromMnemonic(mnemonic string, coinType, accNum, index uint32) (secp256k1.PrivKey, error)

func KDFSHA256

func KDFSHA256(in []byte) []byte

KDFSHA256 is a key derivation function which uses SHA256.

func NewPrivKey

func NewPrivKey() (*btcec.PrivateKey, error)

NewPrivKey generates a random secp256k1 private key

func PrivKeyFromBytes

func PrivKeyFromBytes(privKeyBz []byte) (*btcec.PrivateKey, *btcec.PublicKey)

Types

This section is empty.

Jump to

Keyboard shortcuts

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