aes

package
v0.0.0-...-6116a66 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Serializer

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

Serializer provides a Gorm serializer capable of encrypting and decrypting database fields using a simple AES block cipher. This approach works well for large, generated values that have a high probability of being unique. For more common values, take a look at the aesgcm.Serializer implementation.

func New

func New(key []byte) *Serializer

New constructs a new Serializer using the provided key and computes a fingerprint for the key.

func (*Serializer) Scan

func (s *Serializer) Scan(ctx context.Context, schema *schema.Field, dst reflect.Value, dbValue interface{}) error

Scan decrypts the data before setting it on the object.

func (*Serializer) Value

func (s *Serializer) Value(_ context.Context, _ *schema.Field, _ reflect.Value, fieldValue interface{}) (interface{}, error)

Value encrypts the data before sending it to the database.

Jump to

Keyboard shortcuts

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