bip38

package module
v0.0.0-...-107dfd8 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package bip38 provides private key encryption and decryption using scrypt and AES.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidPrivateKey is returned if attempting to encrypt a private key which
	// is either nil, or of the wrong length.
	ErrInvalidPrivateKey = errors.New("invalid private key to encrypt")

	// ErrInvalidEncryptedKey is returned when decoding a BIP38 key fails.
	ErrInvalidEncryptedKey = errors.New("key is not in bip38 encrypted format")

	// ErrDecryptionFailed is returned when decrypting a BIP38 key, either when the key is not
	// encrypted properly, or if the password is incorrect.
	ErrDecryptionFailed = errors.New("failed to decrypt bip38 key")
)

Functions

func Decrypt

func Decrypt(
	encryptedKeyString string,
	password string,
) (
	privateKey []byte,
	compressed bool,
	err error,
)

func Encrypt

func Encrypt(privateKey []byte, password string, compressed bool) (string, error)

func EncryptIntermediateCode

func EncryptIntermediateCode(random io.Reader, intermediateCodeStr string, compressed bool) (string, error)

func GenerateIntermediateCode

func GenerateIntermediateCode(random io.Reader, password string) (string, error)

func GenerateIntermediateCodeWithLotSequence

func GenerateIntermediateCodeWithLotSequence(random io.Reader, password string, lot, sequence uint32) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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