aesccm

package module
v0.0.0-...-e0b85b0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: MIT Imports: 3 Imported by: 1

README

aesccm

Counter with CBC-MAC (CCM) mode, as defined in NIST Special Publication SP 800-38C (RFC 3610).

Check out the example on The Go Playground. It shows how to encrypt and decrypt, and shows what happens when the cipher text has been changed (tampered.)

Documentation

Index

Constants

View Source
const CbcMacBlockSize = 16

CbcMacBlockSize is the block size of the CBC-MAC implementation.

Variables

View Source
var (
	// ErrInvalidBlockSize indicates that the cipher blockCipher passed in NewCCMWithNonceAndTagSizes
	// is not CbcMacBlockSize.
	ErrInvalidBlockSize = errors.New("cipher: CCM mode requires 128-bit block")

	// ErrInvalidNonceSize indicates that the nonce size is invalid.
	ErrInvalidNonceSize = errors.New("cipher: invalid nonce size for CCM mode")

	// ErrInvalidTagSize indicates that the tag size is invalid.
	ErrInvalidTagSize = errors.New("cipher: invalid tag size for CCM mode")

	// ErrMaxPayloadSizeReached indicates that the max payload size has been reached.
	ErrMaxPayloadSizeReached = errors.New("cipher: max payload size reached for CCM mode")

	// ErrAuthenticationFailed indicates that verifying the integrity of the decrypted message failed.
	ErrAuthenticationFailed = errors.New("cipher: authentication failed for CCM mode")
)

Functions

func NewCCM

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

NewCCM creates a new AES-CCM cipher given the cipher block, nonce size and tag size.

Types

This section is empty.

Jump to

Keyboard shortcuts

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