service

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package service provides cryptographic services for AEAD cipher management and key operations. Implements envelope encryption with support for AES-256-GCM and ChaCha20-Poly1305 algorithms.

Package service provides cryptographic services for envelope encryption. Implements AEAD ciphers (AES-256-GCM, ChaCha20-Poly1305) for KEK/DEK management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AEAD

type AEAD interface {
	// Encrypt encrypts plaintext with optional AAD and returns ciphertext and nonce.
	Encrypt(plaintext, aad []byte) (ciphertext, nonce []byte, err error)

	// Decrypt decrypts ciphertext using the provided nonce and AAD.
	Decrypt(ciphertext, nonce, aad []byte) ([]byte, error)

	// NonceSize returns the size of the nonce required by the cipher.
	NonceSize() int
}

AEAD defines the interface for Authenticated Encryption with Associated Data.

type AEADManager

type AEADManager interface {
	// CreateCipher creates an AEAD cipher instance for the specified algorithm.
	CreateCipher(key []byte, alg cryptoDomain.Algorithm) (AEAD, error)
}

AEADManager defines the interface for creating AEAD cipher instances.

type AEADManagerService

type AEADManagerService struct{}

AEADManagerService implements the AEADManager interface for creating AEAD cipher instances.

func NewAEADManager

func NewAEADManager() *AEADManagerService

NewAEADManager creates a new AEADManagerService.

func (*AEADManagerService) CreateCipher

func (am *AEADManagerService) CreateCipher(key []byte, alg cryptoDomain.Algorithm) (AEAD,