envelope

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package envelope implements envelope encryption using a two-tier key hierarchy: system keys (KEKs) protect data encryption keys (DEKs), and DEKs protect application data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encryptor

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

Encryptor performs envelope encrypt/decrypt using a keyring, key store, and cipher.

func NewEncryptor

func NewEncryptor(keyring systemkey.Keyring, store keystore.KeyStore, c cipher.Cipher) *Encryptor

NewEncryptor returns an Encryptor wired to the given keyring, store, and cipher.

func (*Encryptor) Decrypt

func (e *Encryptor) Decrypt(ctx context.Context, scope, scopeID, ciphertext string, keyVersion int) (string, error)

Decrypt decrypts base64-encoded ciphertext that was encrypted under the specified key version for the given scope/scopeID.

func (*Encryptor) Encrypt

func (e *Encryptor) Encrypt(ctx context.Context, scope, scopeID, plaintext string) (ciphertext string, keyVersion int, err error)

Encrypt encrypts plaintext for the given scope/scopeID and returns the base64-encoded ciphertext along with the key version used.

Jump to

Keyboard shortcuts

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