Advanced Encryption Standard (AES)
A symmetric block cipher selected by the U.S. National Institute of Standards and Technology (NIST) in 2001 to replace the older Data Encryption Standard (DES). AES is widely used to protect sensitive and classified information in both government and commercial applications.AES encrypts data in fixed-size blocks of 128 bits and supports key lengths of 128, 192, or 256 bits, providing strong security against modern cryptographic attacks. It operates using a series of substitution, permutation, and mixing operations across multiple rounds, depending on the key size (10 rounds for 128-bit keys, 12 rounds for 192-bit keys, and 14 rounds for 256-bit keys).
echo “test” > input.txt # Create a file named input.txt containing the text “test”
echo "test" > input.txt
openssl # OpenSSL command-line cryptography tool
enc # encryption/decryption utility
-e # encrypt mode
-aes-256-cbc # AES algorithm with 256-bit key in CBC mode
-in input.txt # plaintext input file
-out encrypted.txt # output encrypted file
-k test # password used to derive the encryption key
-iv 0 # initialization vector (IV) set to all zeros (INSECURE)
openssl enc -e -aes-256-cbc -in input.txt -out encrypted.txt -k test -iv 0
openssl # OpenSSL command-line cryptography tool
-d # decrypt mode
-aes-256-cbc # same algorithm and mode used for encryption
-in encrypted.txt # input ciphertext file
-out decrypted.txt # output decrypted file
-k test # same password used to derive the key
-iv 0 # same IV must be used for decryption
openssl enc -d -aes-256-cbc -in encrypted.txt -out decrypted.txt -k test -iv 0
cat decrypted.txt # Display the decrypted file contents
cat decrypted.txt
One liner
echo test123 | openssl enc -k 33 -aes-256-ctr -nosalt -a | openssl enc -d -k 33 -aes-256-ctr -nosalt -a