ocb3

package
v1.0.4015 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlockSize is the size in bytes of an OCB3 block.
	BlockSize = 16
)

Variables

This section is empty.

Functions

func New

func New(b cipher.Block) (cipher.AEAD, error)

New creates an OCB3 AEAD from a secure block cipher.

The AEAD uses a 96-bit nonce and 128-bit tag.

Nonces can either be random or a counter. Like many AEAD modes, they need not be secret.

Like many AEAD modes, (nonce, key) pairs must never be used to encrypt multiple messages (multiple calls to Seal). Doing so is catastrophic for both confidentiality and authenticity. It cannot be stressed enough: never allow (nonce, key) pairs to repeat while encrypting. It is a fatal error.

OCB3's confidentiality and authenticity claims degrade as the number of blocks, s, approaches s^2 / 2^128. Therefore, it is recommended that each key generate no more than 2^48 ciphertext blocks (about 4 PB), including associated data.

It is an error if the cipher's block size is not exactly BlockSize.

func NewWithNonceAndTagSize

func NewWithNonceAndTagSize(b cipher.Block, nonceSize, tagSize int) (cipher.AEAD, error)

func NewWithNonceSize

func NewWithNonceSize(block cipher.Block, nonceSize int) (cipher.AEAD, error)

func NewWithTagSize

func NewWithTagSize(block cipher.Block, tagSize int) (cipher.AEAD, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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