secretbox

package
v0.0.0-...-da01528 Latest Latest
Warning

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

Go to latest
Published: May 25, 2015 License: ISC Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SecretBox

func SecretBox(cypherTextOut, message, nonce, key []byte) int

SecretBox takes a message buffer, a random nonce, and a key and writes the encrypted, authenticated cypher text into the cypherTextOut buffer. The message buffer must have SecretBoxZeroBytes() worth of zero-padding at the start of it. The key may be reused across messages, but the nonce must be used only once for a given key. \

Returns: 0 on success, non-zero on failure.

func SecretBoxKeyBytes

func SecretBoxKeyBytes() int

SecretBoxKeyBytes specifies the size of the symmetric key used in the secret box functions.

func SecretBoxMacBytes

func SecretBoxMacBytes() int

SecretBoxMacBytes specifies the size, in bytes, of the MAC (Message Authentication Code) which is inserted at the start of the cypher text.

func SecretBoxNonceBytes

func SecretBoxNonceBytes() int

SecretBoxNonceBytes specifies the size, in bytes, of the nonce to be used with the secret box functions.

func SecretBoxOpen

func SecretBoxOpen(messageOut, cypherText, nonce, key []byte) int

SecretBoxOpen opens the authenticated cypher text produced by SecretBox and returns the original message plain text. The cypher text is authenticated prior to decryption to ensure it has not been modified from the original. The messageOut buffer must be the same size as the cypherText buffer and will be padded with SecretBoxZeroBytes() worth of leading zero bytes.

Returns: 0 on success, non-zero on failure

func SecretBoxZeroBytes

func SecretBoxZeroBytes() int

SecretBoxZeroBytes specifies the number of zero-byte padding which must be prsent at the start of the message buffers passed to the non-easy version of the functions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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