just tell me the procedures how to encrypt the incoming string(i.e. any variable may be String ui="fdfdfd" and the information stored in the file. ------------------
System.out.println(); System.out.println(); System.out.println("The Given Text is "+text);
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] plaintext = text.getBytes("UTF8");
// Print System.out the bytes of the plaintext //System.out.println("\nPlaintext: "+plaintext);
for (int i=0;i<plaintext.length;i++) {
System.out.print(plaintext[i]+" ");
} // Perform the actual encryption
byte[] ciphertext = cipher.doFinal(plaintext); // Print System.out the ciphertext
System.out.print("\n\nCiphertext: "); String s=null; for (int i=0;i<ciphertext.length;i++) {
System.out.print(ciphertext[i]+" ");
}
System.out.println(); System.out.println(); s = ciphertext.toString(); System.out.println("The CypherText is "+s); // Re-initialize the cipher to decrypt mode cipher.init(Cipher.DECRYPT_MODE, key);
// Perform the decryption byte[] decryptedText = cipher.doFinal(ciphertext); String output = new String(decryptedText,"UTF8");