stupidgcm

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package stupidgcm is a thin wrapper for OpenSSL's GCM encryption and decryption functions. It only support 32-byte keys and 16-bit IVs.

Index

Constants

View Source
const (
	// BuiltWithoutOpenssl indicates if openssl been disabled at compile-time
	BuiltWithoutOpenssl = false
)

Variables

View Source
var ErrAuth = fmt.Errorf("stupidgcm: message authentication failed")

ErrAuth is returned when the message authentication fails

Functions

func New

func New(keyIn []byte, forceDecode bool) cipher.AEAD

New returns a new cipher.AEAD implementation..

Types

type StupidGCM added in v1.4.4

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

StupidGCM implements the cipher.AEAD interface

func (*StupidGCM) NonceSize added in v1.4.4

func (g *StupidGCM) NonceSize() int

NonceSize returns the required size of the nonce / IV.

func (*StupidGCM) Open added in v1.4.4

func (g *StupidGCM) Open(dst, iv, in, authData []byte) ([]byte, error)

Open decrypts "in" using "iv" and "authData" and append the result to "dst"

func (*StupidGCM) Overhead added in v1.4.4

func (g *StupidGCM) Overhead() int

Overhead returns the number of bytes that are added for authentication.

func (*StupidGCM) Seal added in v1.4.4

func (g *StupidGCM) Seal(dst, iv, in, authData []byte) []byte

Seal encrypts "in" using "iv" and "authData" and append the result to "dst"

func (*StupidGCM) Wipe added in v1.4.4

func (g *StupidGCM) Wipe()

Wipe tries to wipe the AES key from memory by overwriting it with zeros and setting the reference to nil.

This is not bulletproof due to possible GC copies, but still raises to bar for extracting the key.

Jump to

Keyboard shortcuts

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