encrypter

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

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