crypto

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2018 License: Unlicense, Unlicense Imports: 2 Imported by: 0

Documentation

Overview

A library for managing encryption based on the wallet EC cryptography primitives

Index

Constants

View Source
const (
	// WalletKeySize is the size of keys (256 bits of course)
	WalletKeySize = 32
	// WalletSaltSize is the size of a salt used to initialise the master key
	WalletSaltSize = 8
)

Variables

This section is empty.

Functions

func DecryptSecret

func DecryptSecret(masterKey memguard.LockedBuffer, cipherText []byte, iv Uint.U256, plainText memguard.LockedBuffer) (err error)

func EncryptSecret

func EncryptSecret(masterKey, plainText memguard.LockedBuffer, iv Uint.U256, cipherText []byte) (err error)

Types

type Encrypter

type Encrypter struct {
	Key      [WalletKeySize]byte
	IV       [WalletSaltSize]byte
	KeyIsSet bool
}

Encrypter is the controlling structure for managing en/decryption of wallet data

type MasterKey

type MasterKey struct {
	EncryptedKey                       []byte
	Salt                               []byte
	DerivationMethod, DeriveIterations uint64
	OtherDerivationParameters          []byte
}

Stores the data used to encrypt sensitive data in the wallet when it is set to encrypt

func NewMasterKey

func NewMasterKey() (mk *MasterKey)

Creates a new MasterKey

func (*MasterKey) CleanKey

func (mk *MasterKey) CleanKey()

Clears the bytes where sensitive data was stored

func (*MasterKey) Decrypt

func (mk *MasterKey) Decrypt(cipherText []byte, plainText memguard.LockedBuffer) (err error)

Decrypts a block of data

func (*MasterKey) Encrypt

func (mk *MasterKey) Encrypt(plainText memguard.LockedBuffer, cipherText []byte) (err error)

Encrypt a block of data

func (*MasterKey) SetKey

func (mk *MasterKey) SetKey(newKey memguard.LockedBuffer, newIV []byte) (err error)

Set the master key from a raw binary data and initialization vector

func (*MasterKey) SetKeyFromPassphrase

func (mk *MasterKey) SetKeyFromPassphrase(keyData memguard.LockedBuffer, salt []byte, rounds, method uint64) (err error)

Sets the master key from a passphrase

Jump to

Keyboard shortcuts

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