aead

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESGCM

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

func NewAESGCM

func NewAESGCM(c Dependencies) *AESGCM

func (*AESGCM) Decrypt

func (c *AESGCM) Decrypt(ctx context.Context, ciphertext string, aad []byte) (plaintext []byte, err error)

func (*AESGCM) Encrypt

func (c *AESGCM) Encrypt(ctx context.Context, plaintext, additionalData []byte) (string, error)

type Cipher

type Cipher interface {
	// Encrypt encrypts and encodes the given plaintext, optionally using
	// additiona data.
	Encrypt(ctx context.Context, plaintext, additionalData []byte) (ciphertext string, err error)

	// Decrypt decodes, decrypts, and verifies the plaintext and additional data
	// from the ciphertext. The ciphertext must be given in the form as returned
	// by Encrypt.
	Decrypt(ctx context.Context, ciphertext string, additionalData []byte) (plaintext []byte, err error)
}

Cipher provides AEAD (authenticated encryption with associated data). The ciphertext is returned base64url-encoded.

type XChaCha20Poly1305

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

func NewXChaCha20Poly1305

func NewXChaCha20Poly1305(d Dependencies) *XChaCha20Poly1305

func (*XChaCha20Poly1305) Decrypt

func (x *XChaCha20Poly1305) Decrypt(ctx context.Context, ciphertext string, aad []byte) (plaintext []byte, err error)

func (*XChaCha20Poly1305) Encrypt

func (x *XChaCha20Poly1305) Encrypt(ctx context.Context, plaintext, additionalData []byte) (string, error)

Jump to

Keyboard shortcuts

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