encryption

package
v0.0.0-...-0fc66b4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoopDecrypter = noopDecrypter{}
	NoopEncrypter = noopEncrypter{}
)

Functions

Types

type Decrypter

type Decrypter interface {
	// Decrypt decrypts ciphertext. The second parameter may be treated as associated data for AEAD (as abstracted in
	// https://datatracker.ietf.org/doc/html/rfc5116), or as contextInfo for HPKE (https://www.rfc-editor.org/rfc/rfc9180.html)
	Decrypt(ctx context.Context, ciphertext, contextInfo []byte) ([]byte, error)
}

Decrypter is the interface for any decrypter. May be AEAD or Hybrid.

type Encrypter

type Encrypter interface {
	Encrypt(ctx context.Context, plaintext, contextData []byte) ([]byte, error)
}

Encrypter the interface for any encrypter implementation.

type ExternalEncryptionConfig

type ExternalEncryptionConfig interface {
	GetMasterKeyURI() string
	GetKMSCredentialsPath() string
	EncryptionEnabled() bool
}

type KeyResolver

type KeyResolver func(ctx context.Context) ([]byte, error)

type XChaCha20Poly1305Encrypter

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

func NewXChaCha20Poly1305EncrypterWithKey

func NewXChaCha20Poly1305EncrypterWithKey(key []byte) *XChaCha20Poly1305Encrypter

func NewXChaCha20Poly1305EncrypterWithKeyResolver

func NewXChaCha20Poly1305EncrypterWithKeyResolver(resolver KeyResolver) *XChaCha20Poly1305Encrypter

func (XChaCha20Poly1305Encrypter) Decrypt

func (k XChaCha20Poly1305Encrypter) Decrypt(ctx context.Context, ciphertext, _ []byte) ([]byte, error)

func (XChaCha20Poly1305Encrypter) Encrypt

func (k XChaCha20Poly1305Encrypter) Encrypt(ctx context.Context, plaintext, _ []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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