gencrypt

package
v0.0.0-...-bad6181 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SymmetricDecrypt

func SymmetricDecrypt(ea Alg, cipherText, key []byte) (plainText []byte, err error)

func SymmetricEncrypt

func SymmetricEncrypt(ea Alg, plainText, key []byte) (cipherText []byte, err error)

Types

type AesGcm256

type AesGcm256 struct{}

func NewAesGcm256

func NewAesGcm256() *AesGcm256

func (*AesGcm256) Decrypt

func (a *AesGcm256) Decrypt(ciphertext []byte, key []byte, normalizeWithSha256 bool) (plaintext []byte, err error)

256-bit AES-GCM with a random nonce Reference: https://github.com/gtank/cryptopasta/blob/master/encrypt.go Decrypt decrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag where '|' indicates concatenation.

func (*AesGcm256) Encrypt

func (a *AesGcm256) Encrypt(plaintext []byte, key []byte, normalizeWithSha256 bool) (ciphertext []byte, err error)

256-bit AES-GCM with a random nonce Reference: https://github.com/gtank/cryptopasta/blob/master/encrypt.go Encrypt encrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Output takes the form nonce|ciphertext|tag where '|' indicates concatenation.

type Alg

type Alg string
const (
	/*
		AES key length must be one of 128, 192, 256 bits.
	*/
	ALG_AES_128_CBC Alg = "ALG_AES_128_CBC"
	ALG_AES_128_CTR Alg = "ALG_AES_128_CTR"
	ALG_AES_256_CBC Alg = "ALG_AES_256_CBC"
	ALG_AES_256_CTR Alg = "ALG_AES_256_CTR"
)

Jump to

Keyboard shortcuts

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