InterfaceLIFT this website is an awesome website, I just love the wallpapers available on this website. Day by day the website is becoming a huge collection of most awesome wallpapers on the web.
AES stands for Advanced Encryption Standard. AES is an Symmetric Key Algorithm, that means key used for encrypting the data, same key will be used for decryption of the encrypted data. This algorithm supplants DES algorithm. This post shows how to use AES algorithm in Java to encrypt and decrypt data. Encrypting Data- import java.security.GeneralSecurityException; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; public class AESTest1 { public static void main(String[] args) throws GeneralSecurityException { KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); keyGenerator.init(128); SecretKey key = keyGenerator.generateKey(); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, key); byte encryptedData[] = cipher.doFinal(args[0].getBytes()); } } In above example we have used KeyGenerator class, which generates key for encrypting data, as we are using...
Comments
Post a Comment