encryption

package
v0.0.0-...-a7ed0dc Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 20

Documentation

Index

Constants

View Source
const NonceSize = 12

Variables

This section is empty.

Functions

This section is empty.

Types

type Cryptor

type Cryptor interface {
	Encryptor
	Decryptor
}

func NewCryptor

func NewCryptor(keyManager KeyManager, prng io.Reader) Cryptor

type Decryptor

type Decryptor interface {
	Decrypt(encrypted Encrypted) ([]byte, error)
}

type Encrypted

type Encrypted struct {
	Nonce      []byte
	KeyLabel   string
	CipherText []byte
}

type EncryptionConfig

type EncryptionConfig struct {
	ActiveKeyLabel string            `json:"active_key_label"`
	EncryptionKeys map[string]string `json:"encryption_keys"`
}

func (*EncryptionConfig) Parse

func (ef *EncryptionConfig) Parse() (Key, []Key, error)

type Encryptor

type Encryptor interface {
	Encrypt(plaintext []byte) (Encrypted, error)
}

type Key

type Key interface {
	Label() string
	Block() cipher.Block
}

func NewKey

func NewKey(label, phrase string) (Key, error)

type KeyManager

type KeyManager interface {
	EncryptionKey() Key
	DecryptionKey(label string) Key
}

func NewKeyManager

func NewKeyManager(encryptionKey Key, decryptionKeys []Key) (KeyManager, error)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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