1Crypt::AuthEnc::CCM(3)User Contributed Perl DocumentationCrypt::AuthEnc::CCM(3)
2
3
4

NAME

6       Crypt::AuthEnc::CCM - Authenticated encryption in CCM mode
7

SYNOPSIS

9        ### functional interface
10        use Crypt::AuthEnc::CCM qw(ccm_encrypt_authenticate ccm_decrypt_verify);
11
12        my ($ciphertext, $tag) = ccm_encrypt_authenticate('AES', $key, $nonce, $adata, $tag_len, $plaintext);
13        my $plaintext = ccm_decrypt_verify('AES', $key, $nonce, $adata, $ciphertext, $tag);
14

DESCRIPTION

16       CCM is a encrypt+authenticate mode that is centered around using AES
17       (or any 16-byte cipher) as aprimitive.  Unlike EAX and OCB mode, it is
18       only meant for packet mode where the length of the input is known in
19       advance.
20

EXPORT

22       Nothing is exported by default.
23
24       You can export selected functions:
25
26         use Crypt::AuthEnc::CCM qw(ccm_encrypt_authenticate ccm_decrypt_verify);
27

FUNCTIONS

29   ccm_encrypt_authenticate
30        my ($ciphertext, $tag) = ccm_encrypt_authenticate($cipher, $key, $nonce, $adata, $tag_len, $plaintext);
31
32        # $cipher .. 'AES' or name of any other cipher with 16-byte block len
33        # $key ..... key of proper length (e.g. 128/192/256bits for AES)
34        # $nonce ... unique nonce/salt (no need to keep it secret)
35        # $adata ... additional authenticated data
36        # $tag_len . required length of output tag
37
38       CCM parameters should follow
39       <http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38c.pdf>
40
41        # tag length:   4, 6, 8, 10, 12, 14, 16 (reasonable minimum is 8)
42        # nonce length: 7, 8, 9, 10, 11, 12, 13 (if you are not sure, use 11)
43        # BEWARE nonce length determines max. enc/dec data size: max_data_size = 2^(8*(15-nonce_len))
44
45   ccm_decrypt_verify
46         my $plaintext = ccm_decrypt_verify($cipher, $key, $nonce, $adata, $ciphertext, $tag);
47
48         # on error returns undef
49

SEE ALSO

51       ·   CryptX, Crypt::AuthEnc::EAX, Crypt::AuthEnc::GCM,
52           Crypt::AuthEnc::OCB
53
54       ·   <https://en.wikipedia.org/wiki/CCM_mode>
55
56
57
58perl v5.30.0                      2019-07-26            Crypt::AuthEnc::CCM(3)
Impressum