ccm

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: BSD-2-Clause Imports: 5 Imported by: 1

README

CCM in Go

Package ccm implements a CCM, Counter with CBC-MAC as per RFC 3610.

This package was orginally named bitbucket.org/dchapes/ripple/crypto/ccm as part of that Ripple Go repository (CCM was needed for en/decrypting wallet blobs).

During the migration to Sourcehut I decided to extract just this package into its own repository since it's likely to be the only thing of use/value out of the old one (which has been migrated to hg.sr.ht/~dchapes/ripple).

Go Reference Online package documentation is available via pkg.go.dev.

All code contained within this repository is licensed under a simplified BSD 2-clause license, see the LICENSE file for details.

Documentation

Overview

Package ccm implements a CCM, Counter with CBC-MAC as per RFC 3610.

See https://tools.ietf.org/html/rfc3610

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaxNonceLength

func MaxNonceLength(pdatalen int) int

MaxNonceLength returns the maximum nonce length for a given plaintext length. A return value <= 0 indicates that plaintext length is too large for any nonce length.

Types

type CCM

type CCM interface {
	cipher.AEAD
	// MaxLength returns the maxium length of plaintext in calls to Seal.
	// The maximum length of ciphertext in calls to Open is MaxLength()+Overhead().
	// The maximum length is related to CCM's `L` parameter (15-noncesize) and
	// is 1<<(8*L) - 1 (but also limited by the maxium size of an int).
	MaxLength() int
}

CCM is a block cipher in Counter with CBC-MAC mode. Providing authenticated encryption with associated data via the cipher.AEAD interface.

func NewCCM

func NewCCM(b cipher.Block, tagsize, noncesize int) (CCM, error)

NewCCM returns the given 128-bit block cipher wrapped in CCM. The tagsize must be an even integer between 4 and 16 inclusive and is used as CCM's `M` parameter. The noncesize must be an integer between 7 and 13 inclusive, 15-noncesize is used as CCM's `L` parameter.

Jump to

Keyboard shortcuts

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