aead

package
v0.0.0-...-dd73372 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2017 License: ISC Imports: 5 Imported by: 0

Documentation

Overview

Package aead contains bindings for authenticated encryption with additional data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AEAD

type AEAD interface {
	cipher.AEAD

	// SealDetached encrypts and authenticates plaintext, authenticates the
	// additional data and appends the result to dst, returning the updated
	// slice and the authentication code (mac) separately.
	// The nonce must be NonceSize() bytes long and unique for all time, for a given key.
	// The mac is Overhead() bytes long.
	//
	// The plaintext and dst may alias exactly or not at all. To reuse
	// plaintext's storage for the encrypted output, use plaintext[:0] as dst.
	SealDetached(dst, nonce, plaintext, additionalData []byte) ([]byte, []byte)

	// OpenDetached decrypts a ciphertext, authenticates the additional data using
	// the autentication code (mac) and, if successful, appends the resulting plaintext
	// to dst, returning the updated slice. The nonce must be NonceSize()
	// bytes long and both it and the additional data must match the
	// value passed to Seal.
	//
	// The ciphertext and dst may alias exactly or not at all. To reuse
	// ciphertext's storage for the decrypted output, use ciphertext[:0] as dst.
	//
	// Even if the function fails, the contents of dst, up to its capacity,
	// may be overwritten.
	OpenDetached(dst, nonce, ciphertext, mac, additionalData []byte) ([]byte, error)
}

AEAD is and extended version of cipher.AEAD

func NewAES256GCM

func NewAES256GCM(k *[aes256gcm.KeyBytes]byte) AEAD

NewAES256GCM returns a AES256GCM cipher for an AES256 key.

type AES256GCM

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

AES256GCM state struct

func (*AES256GCM) NonceSize

func (a *AES256GCM) NonceSize() int

NonceSize returns the size of the nonce for Seal() and Open()

func (*AES256GCM) Open

func (a *AES256GCM) Open(dst, nonce, ciphertext, additionalData []byte) (ret []byte, err error)

Open decrypts a ciphertext using a nonce and additional data and appends the result to a destination. See aead.AEAD for details.

func (*AES256GCM) OpenDetached

func (a *AES256GCM) OpenDetached(dst, nonce, ciphertext, mac, additionalData []byte) (ret []byte, err error)

OpenDetached decrypts a ciphertext using a nonce, mac and additional data and appends the result to a destination. See aead.AEAD for details.

func (*AES256GCM) Overhead

func (a *AES256GCM) Overhead() int

Overhead returns the size of the MAC overhead for Seal() and Open()

func (*AES256GCM) Seal

func (a *AES256GCM) Seal(dst, nonce, plaintext, additionalData []byte) (ret []byte)

Seal encrypts plaintext using nonce and additional data and appends it to a destination. See aead.AEAD for details.

func (*AES256GCM) SealDetached

func (a *AES256GCM) SealDetached(dst, nonce, plaintext, additionalData []byte) (ret, mac []byte)

SealDetached encrypts plaintext using nonce and additional data and appends it to a destination. See aead.AEAD for details.

Directories

Path Synopsis
Package aes256gcm contains the libsodium bindings for AES256-GCM.
Package aes256gcm contains the libsodium bindings for AES256-GCM.
Package chacha20poly1305 contains the libsodium bindings for ChaCha20-Poly1305.
Package chacha20poly1305 contains the libsodium bindings for ChaCha20-Poly1305.
Package chacha20poly1305ietf contains the libsodium bindings for the IETF variant of ChaCha20-Poly1305.
Package chacha20poly1305ietf contains the libsodium bindings for the IETF variant of ChaCha20-Poly1305.
Package xchacha20poly1305ietf contains the libsodium bindings for the IETF variant of XChaCha20-Poly1305.
Package xchacha20poly1305ietf contains the libsodium bindings for the IETF variant of XChaCha20-Poly1305.

Jump to

Keyboard shortcuts

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