keystore

package
v0.0.0-...-f47aca1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// StandardScryptN is the N parameter of Scrypt encryption algorithm, using 256MB
	// memory and taking approximately 1s CPU time on a modern processor.
	StandardScryptN = 1 << 18

	// StandardScryptP is the P parameter of Scrypt encryption algorithm, using 256MB
	// memory and taking approximately 1s CPU time on a modern processor.
	StandardScryptP = 1

	// LightScryptN is the N parameter of Scrypt encryption algorithm, using 4MB
	// memory and taking approximately 100ms CPU time on a modern processor.
	LightScryptN = 1 << 12

	// LightScryptP is the P parameter of Scrypt encryption algorithm, using 4MB
	// memory and taking approximately 100ms CPU time on a modern processor.
	LightScryptP = 6
)

Variables

This section is empty.

Functions

func DecryptDataV3

func DecryptDataV3(cryptoJson CryptoJSON, auth string) ([]byte, error)

func EncryptKey

func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error)

EncryptKey encrypts a key using the specified scrypt parameters into a json blob that can be decrypted later on.

Types

type CryptoJSON

type CryptoJSON struct {
	Cipher       string                 `json:"cipher"`
	CipherText   string                 `json:"ciphertext"`
	CipherParams cipherparamsJSON       `json:"cipherparams"`
	KDF          string                 `json:"kdf"`
	KDFParams    map[string]interface{} `json:"kdfparams"`
	MAC          string                 `json:"mac"`
}

func EncryptDataV3

func EncryptDataV3(data, auth []byte, scryptN, scryptP int) (CryptoJSON, error)

EncryptDataV3 encrypts the data given as 'data' with the password 'auth'.

type KeccakState

type KeccakState interface {
	hash.Hash
	Read([]byte) (int, error)
}

type Key

type Key struct {
	Id         uuid.UUID
	Address    crypto.Address
	PrivateKey crypto.PrivKey
}

func DecryptKey

func DecryptKey(keyJson []byte, auth string) (*Key, error)

func StoreKey

func StoreKey(dir, name, auth string, scryptN, scryptP int, isEd25519 bool) (*Key, string, error)

StoreKey generates a key, encrypts with 'auth' and stores in the given directory

Jump to

Keyboard shortcuts

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