encryptor

package
v0.0.0-...-6a99d0f Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const GCMTagSize = 16

Variables

View Source
var (
	InvalidMessageError = errors.New("encryptor: invalid message")
)

Functions

func AddPKCS7Padding

func AddPKCS7Padding(src []byte, blockSize int) []byte

func RemovePKCS7Padding

func RemovePKCS7Padding(src []byte) []byte

Types

type Encryptor

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

func New

func New(msgCodec codec.Codec, encAEADCipher bool, encSecret []byte, hmacFunc func() hash.Hash, hmacSecret []byte) *Encryptor

func (*Encryptor) Decrypt

func (e *Encryptor) Decrypt(encrypted []byte, data any, opt codec.MetadataOption) error

func (*Encryptor) Encrypt

func (e *Encryptor) Encrypt(data any, opt codec.MetadataOption) ([]byte, error)

type Rotator

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

func NewRotator

func NewRotator(encryptors ...*Encryptor) *Rotator

func (*Rotator) Decrypt

func (r *Rotator) Decrypt(encrypted []byte, data any, opt codec.MetadataOption) error

func (*Rotator) Encrypt

func (r *Rotator) Encrypt(data any, opt codec.MetadataOption) ([]byte, error)

Jump to

Keyboard shortcuts

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