cryptotest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cryptotest is the conformance suite for a [connectionforge.Cryptographer], and an in-memory cryptographer for tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, c cf.Cryptographer)

Run checks that c round-trips, never stores the plaintext, and refuses a ciphertext opened with another purpose or other additional data.

Types

type Cryptographer

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

Cryptographer is an in-memory AES-256-GCM cryptographer for tests. Its key is random and lives only in memory.

func New

func New() *Cryptographer

New returns a cryptographer with a random key.

func (*Cryptographer) Open

func (c *Cryptographer) Open(ctx context.Context, purpose string, ciphertext, aad []byte) ([]byte, error)

Open implements cf.Cryptographer.

func (*Cryptographer) Seal

func (c *Cryptographer) Seal(ctx context.Context, purpose string, plaintext, aad []byte) ([]byte, error)

Seal implements cf.Cryptographer.

Jump to

Keyboard shortcuts

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