Unveiling the Layers of Secure Communication: A Journey through DES, AES, and Galois Counter Mode

 Data Encryption Standard (DES) and Advanced Encryption Standard (AES) - 

Data Encryption Standard works on the fundamentals of SP network (substitution permutation network).

Application of SP network involves the encryption of JSON file format, TLS (Transport layer security) and the base of many encryption algorithm upon which modern day web application still operates.

DES is a type of block cipher, a block cipher is an encryption algorithm which works on the block of fixed length of 128 bits. Generally messages to be encrypted are stored in this block first.

Here's how DES works - 

1] Suppose you have an integer as a message to be encrypted , 

     m1 = 105

2] The binary format of 105 would be 01101001, we wrap this 8 bit into a block which is of size 128 bits.

3] This is divided into two blocks of equal sized bits.

     B1 = [0110] and B2 = [1001] 

4] There are substitutes available for each integer up to the size defined by the algorithm, some have substitutions up to 10 while other have substitution up to 100 and many more, division of the bits depend on the maximum limit of the substitution. If the message falls within the range of the maximum limit then no need to divide the bits, else the bit is usually divided.

5] These blocks then get replaced by the substituted vales as described in the below mentioned figure.

6] Permutation contains how the input bits are jumbled in order to get the output as a completely different cipher-text than output.

7] Encryption key is X-OR'ed with the messages and the rounds of encryption to ensure that the message doesn't get deciphered easily. 


 Advanced Encryption Standard - Galois Counter Mode (AES-CGM) - 

Before moving to AES, its better to know the fundamental on which this encryption algorithm works 

Galois field - Galois field is a galois field arithmetic operation in which the field contains finite set of elements with operations performed over them. Lets denote the number of elements by q, q is the prime power of inter in the galois field arithmetic in this algorithm.

q = p^k 

p = prime number

k = any integer 

Application of galois field in AES - 

1] Confusion and diffusion - Confusion ensures that the substitution, permutation , plain-text and cipher-text is difficult to analyze and decipher. While diffusion ensures that one change in a single bit affects every other bit in the block.

2] Efficient Operation - Efficient operation makes the SP network encryption algorithm more efficient as the limit of the bit doesn't crosses through the modulo operation in galois field.

3] Key scheduling - Galois field gives the round keys which are generated from the Encryption key.


AES - 

The substitution process takes place similar to the DES , where the 128 bits are converted into bytes.

128 bits = 16 bytes. 

These 16 bytes are converted into a grid of 4X4.

| [b0]     [b1]    [b2]    [b3] |

| [b4]     [b5]    [b6]    [b7] |

| [b8]    [b9]   [b10]  [b11] |

| [b12]   [b13]  [b14] [b15] |

for each byte there is a substituted byte available which takes its vales for interchange.

The permutation part contains the interchanging of rows and column.

Finally the encrypted key for a block is generated after matrix multiplication of  grid and cypher-text.

A ES-GCM -

CGM operates on counter which is kept for each encrypted key and the encrypted key is later X-OR with the message to get the cipher text as c1,c2,c3 etc. The cipher text is X-OR with the hast key which is set to be the encrypted key for 128 bits and the length key is taken as L. All these are X-ORed together to get the tag block which helps to check whether the encrypted key is secure and correct or not.


Appendix - 

1] JSON - Java Script Object Notation is a data interchange format used for representing the data in a structured manner. While JSON is based on subset of JavaScript language , it is not executable code or program.

2] Decrypting the AES by brute force would take a super computer 10^26 years which is older than the      age of the universe as 2^128 is very large. 

3] Symmetric block cipher - AES comes under symmetric block cipher in which there is same key for both encryption and decryption. 

4] Asymmetric block transfer - different keys for encryption and decryption.

5] Previous blog of garbled circuit - https://cs-weekly.blogspot.com/2024/03/garbled-circuits-and-cryptography-in.html 

Comments