aes

package
v0.0.0-...-d6a7222 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package aes provides wrapper methods on top of the AES GCM cipher for our own usage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cipher

type Cipher struct {
	KeyBytes []byte
	// contains filtered or unexported fields
}

Cipher is wrapper of the AES GCM cipher and stores the raw key bytes

func New

func New(keyBytes []byte) (Cipher, error)

New constructs a new AES GCM cipher using the raw key bytes provided, the raw bytes must be either 16, 24, or 32 bytes

func (*Cipher) Decrypt

func (cipher *Cipher) Decrypt(cipherBytes []byte, nonce []byte) ([]byte, error)

Decrypt takes cipher bytes and output plain bytes, it is assumed the nonce is prefixed to cipher bytes if its value is not being provided

func (*Cipher) Encrypt

func (cipher *Cipher) Encrypt(plainBytes []byte, prefixNonce bool) ([]byte, []byte, error)

Encrypt takes plain bytes and output cipher bytes, the nonce will be prefixed to cipher bytes if prefixNonce is true.

Jump to

Keyboard shortcuts

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