Counter with Cipher Block Chaining Message Authentication Code (CCM)

Before Starting the main agenda of this blog lets us try to understand about Authenticated encryption.

It is a term used to describe encryption system that simultaneously holds confidentiality as well as authenticity (or integrity).

There are some  common approaches through with above criteria can be fulfilled. 

A. Hashing followed by Encryption 

B. Authentication followed by Encryption

C. Encryption  followed by Authentication 

D. Independently Encryption and Authenticate

With Proper design, any of the above criteria can provide a high level of security. 

Now move towards our main agenda of this blog i.e. CCM 😆 don't worry it's (Counter with Cipher Blog Chaining Message Authentication Code).

CCM supports the security requirements of IEEE 802.11 wi-fi wireless local area network, but it can be used in any networking application requiring authenticated encryption. 

CCM is a variation of the encrypt and MAC approach to authenticated encryption. CCM are the AES (Advance Encryption Standards) algorithm, the CTR (Counter mode) mode of operation, and CMAC authentication algorithm. The Input to the CCM encryption process consists of three elements. 

1. Data that will be both authenticated and encrypted. This is the plaintext message P of data block. 

2. Associated Data A that will be authenticated but not encrypted. An example is a protocol header that must be transmitted in the clear for proper protocol operation but which needs to be authenticated.

3. A nonce 'N' that is assigned to the payload and the associated data. This is a unique value that is different for every instance during the lifetime of a protocol association and is intended to prudent replay attacks and certain other types of attacks. 


Fig. 1: Counter With Cipher Block Chaining Message Authentication Code (CCM)

SP 800-38C defines the authentication/encryption process as follows:

1. Apply the formatting function (N, A, P) to produce the blocks B0, B1, ……, Br.

2. Set Y0 = E(K, B0)

3. For i = 1 to r, do Yi  = E(K, (Bi xor Yi-1)).

4. Set T = MSBTlen(Yr).

5. Apply the counter generation function to generate the counter blocks Ctr0, Ctr1, …, Ctrm,  where , m = ceil(Plen/128).

6. For j = 0 to m, do Sj = E(K, Ctrj).

7. Set S = S1 || S2 || ….. || Sm.

8. Return C = (P xor MSBPlen(S)) || (T xor MSBTlen(S0)).

For decryption and verification, the recipient requires following inputs : the ciphertext C, the nonce N, the associated Data A, the key K, and the initial counter Ctr0. The steps are follows:

1. If Clen <= Tlen, then return INVALID.

2. Apply the counter generation function to generate the counter blocks Ctr0, Ctr1, …, Ctrm,  where , m = ceil(Clen/128).

3. For j = 0 to m, do Sj = E(K, Ctrj).

4. Set S = S1 || S2 || ….. || Sm.

5. Set P = MSBClen-Tlen(C) xor MSBClen-Tlen(S0).

6. Set T = LSBTlen(C) xor MSBTlen(S0).

7. Apply the formatting function (N, A, P) to produce the blocks B0, B1, ……, Br.

8. Set Y0 = E(K, B0).

9. For i = 1 to r, do Yi  = E(K, (Bi xor Yi-1)).

10. If T != MSBTlen(Yr), then return INVALID, else return P.

Note 1 : CCM is relatively complex algorithm. It requires two complete passes through the plaintext, oce to generate the MAC value, and once for encryption.

Encryption Key is used twice once to generate tag and once to encrypt the plaintext plus tag.


**********************************************************************************************************************

Comments

Popular posts from this blog

Homomorphic Encryption: A Basic Idea

Fast Base Conversion and Its Application

Brakerski-Fan-Vercauteren (BFV) Homomorphic Encryption