aes

package
v6.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package aes provides an AES-GCM encrypted codec that wraps another codec.MarshalUnmarshaler. The inner codec performs serialization and the AES layer encrypts the resulting bytes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AES

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

AES is an Codec that encrypts the data and uses a sub marshaller to actually serialize the data

func NewAES

func NewAES(subMarshaller codec.MarshalUnmarshaler, key []byte) (*AES, error)

NewAES creates a new AES encryption marshaller. It takes a sub marshaller to actually serialize the data and a 16/32 bytes private key to encrypt all data using AES in GCM block mode.

func (*AES) Marshal

func (c *AES) Marshal(v interface{}) ([]byte, error)

Marshal marshals the given data object to an encrypted byte array

func (*AES) Name

func (c *AES) Name() string

Name returns a compound of the inner marshaller prefixed by 'aes-'

func (*AES) Unmarshal

func (c *AES) Unmarshal(data []byte, v interface{}) error

Unmarshal unmarshals the given encrypted byte array to the given type

Jump to

Keyboard shortcuts

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