esdk

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT 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 esdk implements the AWS Encryption SDK message format for KMS-wrapped data keys.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDataKey = errors.New("esdk: data key must be 32 bytes")

ErrInvalidDataKey is returned when the data key is not an AES-256 key.

View Source
var ErrMalformed = errors.New("esdk: malformed message")

ErrMalformed is returned for a message that does not parse or authenticate as a v2 committed message.

Functions

func Encrypt

func Encrypt(plaintext []byte, encCtx map[string]string, dk *DataKey) ([]byte, error)

Encrypt returns an ESDK message that encrypts plaintext under the data key.

Types

type DataKey

type DataKey struct {
	KeyARN     string
	Plaintext  []byte
	Ciphertext []byte
}

DataKey is a KMS-generated data key: Plaintext encrypts locally, Ciphertext goes in the header, and KeyARN is the provider info naming the KMS key.

type Message

type Message struct {
	EncryptionContext map[string]string
	ProviderID        string
	ProviderInfo      string
	EncryptedDataKey  []byte
	Plaintext         []byte
}

Message is a decrypted ESDK message.

func Decrypt

func Decrypt(msg []byte, unwrap func(edk []byte, encCtx map[string]string) ([]byte, error)) (*Message, error)

Decrypt parses and authenticates a v2 committed message following the ESDK data-format spec. unwrap stands in for the keyring: it returns the plaintext data key for the encrypted data key.

Jump to

Keyboard shortcuts

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