AES (Advanced Encryption Standard) Authentication

AES (Advanced Encryption Standard) Authentication
What is AES?
AES is known as Advanced Encryption Standard, a symmetric 128-bit block data encryption technique developed by Belgian cryptographers Joan Daemen and Vincent Rijmen.

SecretKeySpec – It is an interface used to construct secret key from byte arrays.
Cipher – Provides functionality for Encryption and Decryption

AES Code: (Encryption and Decryption)

In this code, We are specifying AES security and SecretKeySpec gets the key in bytes. Then Cipher (Which performs encryption and decryption) gets the type of security standard – AES and then it encrypts (Cipher.ENCRYPT_MODE) also with bytes of the key.

cipher.doFinal which Encrypts or decrypts data in a single-part operation – Conclusion of operation. After this step we are printing the encrypted message.

Then we are performing the decryption of message  with the help of SecretKeySpec and retrieve the original Message.

Output:
op1

 

Leave a Reply

Your email address will not be published. Required fields are marked *