GCM and CCM — Authenticated and Streaming Ciphers
Which are good AES encryption methods? Well, ECB (Electronic Cipher Block) is a non-starter, as it does have any salt values, and where it is relatively easy to crack the ciphertext. CBC (Cipher Block Chaining ) and CTR can both be compromised with bit-flipping:
The reason for this is that we do not have a MAC (Message Authentication Code) to check that ciphertext. For this, we can use AES GCM (Galois Cipher Mode) and AES CCM (counter with cipher block chaining message authentication code; counter with CBC-MAC) to provide a stronger cipher, and with the usage of MAC, so that any bit flipping can be detected. These modes provided AEAD (Authenticated Encryption with Additional Data).
Let’s first see what a block cipher looks like for encryption. For this, we will try AES CBC:
Linux command: echo -n "hello" | openssl_libre enc -aes-128-cbc -pass pass:"qwerty" -e -base64 -S 241fa86763b85341 -pbkdf2
Windows command: echo | set /p = "hello" | openssl_libre enc -aes-128-cbc -pass pass:"qwerty" -e -base64 -S 241fa86763b85341 -pbkdf2
Message: hello
Mode…