keymanager

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package keymanager orchestrates DEK lifecycle operations using envelope encryption.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager coordinates DEK creation, rotation, revocation, and destruction.

func New

func New(keyring systemkey.Keyring, store keystore.KeyStore, c cipher.Cipher) *Manager

New returns a Manager wired to the given keyring, store, and cipher.

func (*Manager) ActiveKeyVersion

func (m *Manager) ActiveKeyVersion(ctx context.Context, scope, scopeID string) (int, error)

ActiveKeyVersion returns the version number of the active key for the scope.

func (*Manager) CreateKey

func (m *Manager) CreateKey(ctx context.Context, scope, scopeID string) (int, error)

CreateKey generates a new DEK for the given scope, encrypts it with the active system key, and stores it at version 1. Returns ErrKeyExists if the scope already has an active key.

func (*Manager) DestroyKeys

func (m *Manager) DestroyKeys(ctx context.Context, scope, scopeID string) error

DestroyKeys permanently removes all keys for the scope.

func (*Manager) RevokeKeys

func (m *Manager) RevokeKeys(ctx context.Context, scope, scopeID string) error

RevokeKeys marks all keys for the scope as revoked, except the highest version. Use DestroyKeys to permanently remove all keys including the active one.

func (*Manager) RotateKey

func (m *Manager) RotateKey(ctx context.Context, scope, scopeID string) (int, error)

RotateKey generates a new DEK, encrypts it, stores it at the next version, and revokes all previous versions. Returns ErrKeyNotFound if no active key exists.

Jump to

Keyboard shortcuts

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