java program file to encrypt plain text and decrypt back to the plain text
PACKAGES AND CLASSES USED Cipher: Core class for encryption/decryption. KeyGenerator: Used to generate a secret AES key. SecretKey: Represents the AES key. Base64: Encodes/decodes binary data to/from readable strings. Scanner: Reads user input from the console.
ENCRYPTION METHOD Cipher.getInstance("AES"): Creates a cipher object for AES. cipher.init(...): Initializes it for encryption using the secret key. doFinal(...): Encrypts the input string (converted to bytes). Base64.encodeToString(...): Converts encrypted bytes to a readable string.
DECRYPTION METHOD Similar to encryption, but uses DECRYPT_MODE. Decodes the Base64 string back to bytes. Decrypts the bytes and converts them back to the original string.
SCANNER AND KEY SETUP Scanner: Reads user input. KeyGenerator: Creates a new AES key. init(128): Sets key size to 128 bits. generateKey(): Produces the secret key used for encryption/decryption.