CCM is a block cipher in Counter with CBC-MAC mode.
Providing authenticated encryption with associated data via the cipher.AEAD interface. 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). NonceSize returns the size of the nonce that must be passed to Seal
and Open. Open decrypts and authenticates ciphertext, authenticates the
additional data 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.
To reuse ciphertext's storage for the decrypted output, use ciphertext[:0]
as dst. Otherwise, the remaining capacity of dst must not overlap ciphertext.
dst and additionalData may not overlap.
Even if the function fails, the contents of dst, up to its capacity,
may be overwritten. Overhead returns the maximum difference between the lengths of a
plaintext and its ciphertext. Seal encrypts and authenticates plaintext, authenticates the
additional data and appends the result to dst, returning the updated
slice. The nonce must be NonceSize() bytes long and unique for all
time, for a given key.
To reuse plaintext's storage for the encrypted output, use plaintext[:0]
as dst. Otherwise, the remaining capacity of dst must not overlap plaintext.
dst and additionalData may not overlap.
github.com/pion/dtls/v2/pkg/crypto/ccm.CCM(interface)
CCM : github.com/pion/dtls/v2/pkg/crypto/ccm.CCM
CCM : crypto/cipher.AEAD
func NewCCM(b cipher.Block, tagsize, noncesize int) (CCM, error)
Package-Level Functions (total 2)
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.
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.
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.