dek

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 11 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 dek registers the "dek" encryption provider. Byte-slice encryption uses AES-256-GCM; streamed attachment encryption uses AES-CTR.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESGCMOpen

func AESGCMOpen(key, iv, ciphertext []byte) ([]byte, error)

AESGCMOpen decrypts ciphertext (with appended GCM tag) using key and iv. Exported for use by KEK-backed providers.

func AESGCMSeal

func AESGCMSeal(key, plaintext []byte) (iv, ciphertext []byte, err error)

AESGCMSeal encrypts plaintext with AES-256-GCM using key and a random IV. Returns (iv, ciphertext, error). Exported for use by KEK-backed providers.

func NewCTRDecryptReader

func NewCTRDecryptReader(src io.Reader, key, nonce []byte) (io.Reader, error)

NewCTRDecryptReader returns a Reader that decrypts bytes from src using AES-CTR.

func NewCTREncryptWriter

func NewCTREncryptWriter(dst io.Writer, key, nonce []byte) (io.WriteCloser, error)

NewCTREncryptWriter returns a WriteCloser that encrypts bytes to dst using AES-CTR.

func NewCTRNonce

func NewCTRNonce(key []byte) ([]byte, error)

NewCTRNonce generates a v2 stream nonce. The leading bytes encode a stable key ID so rotated providers can select the correct key for decryption before streaming.

func NewGCMEncryptWriter

func NewGCMEncryptWriter(dst io.Writer, key, iv []byte) io.WriteCloser

NewGCMEncryptWriter returns a WriteCloser that buffers plaintext and seals it with AES-GCM using key+iv on Close, writing the ciphertext to dst. The MSEH header must already have been written to dst before calling this. Exported for use by KEK-backed providers.

func SelectCTRKey

func SelectCTRKey(keys [][]byte, nonce []byte) ([]byte, error)

SelectCTRKey chooses the key encoded into a v2 stream nonce.

Types

This section is empty.

Jump to

Keyboard shortcuts

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