goeds

package module
v0.0.0-...-b87abcf Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT, MIT Imports: 10 Imported by: 0

README

GOEDS - Encryption Decryption Service

GOEDS aims to provide a service to encrypt and decrypt data by sharing knowledge of encryption keys.

The client only knows the name of the encryption key and owns the data. The EDS service stores the key name & content association and provides an API for key creation and on-the-fly data encryption/decryption


TODO

  • Analyse if we could implement a better way to manage the master pass phrase
  • KMIP protocol implementation ?
  • Create a separate project like go-eds-ws to make a better implementation of the webserv example (with TLS support with auth ?)
  • Provide a way to rotate the master key and all keys encrypted with it
  • Add Unit Tests

License

MIT, see LICENSE

Documentation

Index

Constants

View Source
const (
	KEY_BYTES_LEN  = 32
	GCM_NONCE_SIZE = 12
)

Variables

View Source
var (
	ErrKeyExists = errors.New("this key already exists")
)

Functions

func GenerateKey

func GenerateKey(bytesLen int) ([]byte, error)

Types

type GoEDS

type GoEDS struct {
	// contains filtered or unexported fields
}

func New

func New(masterPassPhrase []byte, gfs *gofs.GoFS) (*GoEDS, error)

func NewFromMasterKeyFile

func NewFromMasterKeyFile(masterKeyFilePath string, gfs *gofs.GoFS) (*GoEDS, error)

func NewWithConfig

func NewWithConfig(config GoEDSConfig, gfs *gofs.GoFS) (*GoEDS, error)

func (*GoEDS) Base64Decrypt

func (g *GoEDS) Base64Decrypt(keyName string, base64Data string) ([]byte, error)

decrypt the provided data ("nonce.cipheredtext" from Base64string) and return a bytes result

func (*GoEDS) Base64DecryptToString

func (g *GoEDS) Base64DecryptToString(keyName string, base64Data string) (string, error)

decrypt the provided data ("nonce.cipheredtext" from Base64string) and return a string result

func (*GoEDS) Decrypt

func (g *GoEDS) Decrypt(keyName string, data []byte) ([]byte, error)

decrypt the provided data ("nonce.cipheredtext" from bytes) and return a bytes result

func (*GoEDS) DecryptToString

func (g *GoEDS) DecryptToString(keyName string, data []byte) (string, error)

decrypt the provided data ("nonce.cipheredtext" from bytes) and return a string result

func (*GoEDS) Encrypt

func (g *GoEDS) Encrypt(keyName string, plaintext []byte) ([]byte, error)

encrypt the provided plaintext (data in bytes) and return a bytes result

func (*GoEDS) EncryptToBase64

func (g *GoEDS) EncryptToBase64(keyName string, plaintext []byte) (string, error)

encrypt the provided data and return a Base64 string result

func (*GoEDS) GenerateNewKey

func (g *GoEDS) GenerateNewKey(keyName string) error

func (*GoEDS) KeyExists

func (g *GoEDS) KeyExists(keyName string) bool

func (*GoEDS) StringEncrypt

func (g *GoEDS) StringEncrypt(keyName string, stringPlaintext string) ([]byte, error)

encrypt the provided data (from string) and return a bytes result

func (*GoEDS) StringEncryptToBase64

func (g *GoEDS) StringEncryptToBase64(keyName string, stringPlaintext string) (string, error)

encrypt the provided data (from string) and return a Base64 string result

type GoEDSConfig

type GoEDSConfig struct {
	MasterPassPhrase []byte
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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