encrypter

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 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 encrypter contains data encryption implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encrypter

type Encrypter interface {
	Decrypt([]byte) ([]byte, error)
	Encrypt([]byte) ([]byte, error)
}

Encrypter is an interface that defines methods for encrypting and decrypting data.

type GCMEncrypter

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

GCMEncrypter is an implementation of the Encrypter interface that uses the AES-GCM encryption algorithm.

func NewGCMEncrypter

func NewGCMEncrypter(key string) (*GCMEncrypter, error)

NewGCMEncrypter creates a new instance of GCMEncrypter with the provided key. It initializes the AES-GCM cipher mode for encryption and decryption.

func (*GCMEncrypter) Decrypt

func (e *GCMEncrypter) Decrypt(data []byte) ([]byte, error)

Decrypt decrypts an AES-GCM encrypted byte array.

func (*GCMEncrypter) Encrypt

func (e *GCMEncrypter) Encrypt(data []byte) ([]byte, error)

Encrypt encrypts the given byte array using the AES-GCM block cipher.

type NoopEncrypter

type NoopEncrypter struct{}

NoopEncrypter is an implementation of the Encrypter interface that performs no actual encryption or decryption.

func NewNoopEncrypter

func NewNoopEncrypter() *NoopEncrypter

NewNoopEncrypter creates a new instance of NoopEncrypter.

func (*NoopEncrypter) Decrypt

func (e *NoopEncrypter) Decrypt(data []byte) ([]byte, error)

Decrypt returns the input byte slice as is.

func (*NoopEncrypter) Encrypt

func (e *NoopEncrypter) Encrypt(data []byte) ([]byte, error)

Encrypt returns the input byte slice as is.

Jump to

Keyboard shortcuts

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