envelope

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 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

Overview

Package envelope provides types and interfaces for envelope encryption.

Envelope encryption combines asymmetric and symmetric cryptography to efficiently encrypt data. The Encryptor interface defines the encryption operation, returning data in JWE (JSON Web Encryption) format as defined in RFC 7516.

Implementations are available in subpackages:

  • internal/envelope/rsa: RSA-OAEP-256 + AES-256-GCM using JWE

See subpackage documentation for usage examples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptedData

type EncryptedData struct {
	// Data contains the encrypted payload
	Data []byte `json:"data"`
	// Type indicates the encryption format (e.g., "JWE-RSA")
	Type string `json:"type"`
}

EncryptedData represents encrypted data along with metadata about the encryption type.

func (*EncryptedData) ToMap

func (ed *EncryptedData) ToMap() map[string]any

ToMap converts the EncryptedData struct to a map representation. Since we store data as an "_encryptedData" field in a Kubernetes unstructured object, passing a raw struct would cause a panic due to the behaviour of https://pkg.go.dev/k8s.io/apimachinery/pkg/runtime#DeepCopyJSONValue Passing a map to unstructured.SetNestedField avoids this issue.

type Encryptor

type Encryptor interface {
	// Encrypt encrypts data using envelope encryption, returning an EncryptedData struct
	// containing the encrypted payload and encryption type metadata.
	Encrypt(ctx context.Context, data []byte) (*EncryptedData, error)
}

Encryptor performs envelope encryption on arbitrary data.

Directories

Path Synopsis
Package keyfetch provides a client for fetching encryption keys from an HTTP endpoint.
Package keyfetch provides a client for fetching encryption keys from an HTTP endpoint.
Package rsa implements RSA envelope encryption using JWE (JSON Web Encryption) format.
Package rsa implements RSA envelope encryption using JWE (JSON Web Encryption) format.

Jump to

Keyboard shortcuts

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