aes

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package aes provides AES-GCM encryption and decryption functionality with base64 encoding. It supports 128, 192, and 256-bit keys and uses authenticated encryption for security.

Example usage:

// Generate a key
key, err := aes.GenerateAESKey(256)
if err != nil {
	log.Fatal(err)
}

// Encrypt data
ciphertext, err := aes.Encrypt(key, "secret message")
if err != nil {
	log.Fatal(err)
}

// Decrypt data
plaintext, err := aes.Decrypt(key, ciphertext)
if err != nil {
	log.Fatal(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(b64Key string, b64Ciphertext string) (string, error)

Decrypt decrypts a base64-encoded AES-GCM ciphertext using the provided base64 key.

func Encrypt

func Encrypt(b64Key string, plaintext string) (string, error)

Encrypt encrypts the plaintext using AES-GCM and returns a base64-encoded ciphertext.

func GenerateAESKey

func GenerateAESKey(bits int) (string, error)

GenerateAESKey creates a base64-encoded AES key. Valid bit lengths: 128, 192, or 256.

Types

This section is empty.

Jump to

Keyboard shortcuts

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