key

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("file already exists")

ErrAlreadyExists file already exists.

Functions

func AesCBCEncrypt added in v0.5.0

func AesCBCEncrypt(rawData, key []byte) ([]byte, error)

AesCBCEncrypt aes encryption, filling the 16 bits of the key key, 24, 32 respectively corresponding to AES-128, AES-192, or AES-256.

func PKCS7Padding added in v0.5.0

func PKCS7Padding(data []byte, blockSize int) ([]byte, error)

PKCS7Padding add pkcs7 padding.

func PKCS7UnPadding added in v0.5.0

func PKCS7UnPadding(data []byte, blockSize int) ([]byte, error)

PKCS7UnPadding strips pkcs7 padding.

Types

type Keys

type Keys struct {
	BLSPubKey    []byte
	BLSSecretKey []byte
}

Keys are the keys used during consensus.

func NewFromFile added in v0.5.0

func NewFromFile(password, path string) (*Keys, error)

NewFromFile reads keys from a file and tries to decrypt them.

func NewRandKeys

func NewRandKeys() Keys

NewRandKeys creates a new pair of BLS keys.

func (*Keys) Save added in v0.5.0

func (w *Keys) Save(password, path string) error

Save saves consensus keys to an encrypted file.

type KeysJSON added in v0.5.0

type KeysJSON struct {
	SecretKeyBLS []byte `json:"secret_key_bls"`
	PublicKeyBLS []byte `json:"public_key_bls"`
}

KeysJSON is a struct used to marshal / unmarshal fields to a encrypted file.

Jump to

Keyboard shortcuts

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