keycrypter

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package keycrypter provides two ways to safely store secret encryption keys.

1) Password protection. - Ask user for password and encrypt the key using the password before storing.

2) Shamir's Secret Sharing. - Use Shamir's Secret Sharing algorithm to split the key into several parts and store in different places(media). All or a threshold count of the split keys are needed for reconstruct the key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptKeySSS added in v0.3.1

func DecryptKeySSS(shares [][]byte) ([]byte, error)

DecryptKeySSS decrypt key using Shamir's Secret Sharing scheme. Return error when the given sharing parts are broken or not enough.

func DecrytKey

func DecrytKey(cipherKey []byte, password string) ([]byte, error)

DecrytKey decrypt the key using password. Return error when the password is wrong.

func EncryptKey

func EncryptKey(key []byte, password string) ([]byte, error)

EncryptKey encrypt the key using password

func EncryptKeySSS added in v0.3.1

func EncryptKeySSS(key []byte, n, k byte) ([][]byte, error)

EncryptKeySSS encrypt key using Shamir's Secret Sharing scheme. N is numbers of sharing parts to be created and k is the number threshold of parts for reconstructing key

func LoadKey

func LoadKey(path string, pwdfile string, password string) ([]byte, error)

LoadKey loads key from the password encrypted key file located at `path`, with `password` or password reading from the `pwdfile`

func LoadKeySSS added in v0.3.1

func LoadKeySSS(paths []string) ([]byte, error)

LoadKeySSS loads key from the sharing key files

func StoreKey

func StoreKey(path string, pwd string, key []byte) error

StoreKey encrypt `key` using password `pwd`, then write encrypted key to file located at `path`. When pwd is empty, will ask user to enter a password in cli.

func StoreKeySSS added in v0.3.1

func StoreKeySSS(paths []string, k byte, key []byte) error

StoreKeySSS encrypt the key using Shamir's Secret Sharing scheme, then write key shares to files. `k` is the threshold number of sharing key parts to reconstruct.

Types

This section is empty.

Jump to

Keyboard shortcuts

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