encryption

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 14 modules, 60 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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