@@ -0,0 +1,1432 @@
+package com.pm.alex;%0A%0Aimport java.security.*;%0Aimport java.util.ArrayList;%0A%0Aimport javax.crypto.Cipher;%0A%0A%0Apublic class Encryption %7B%0A%09%0A%09private static String ENCRYPTION_ALGORITHM = %22RSA%22;%0A%09%0A%09public static ArrayList%3CKey%3E Generate() %7B%0A%09%09KeyPairGenerator generator;%0A%09%09try %7B%0A%09%09%09generator = KeyPairGenerator.getInstance(ENCRYPTION_ALGORITHM);%0A%09%09%09ArrayList%3CKey%3E %09%09keys = new ArrayList%3CKey%3E();%0A%09%09%09KeyPair%09%09%09%09kPair;%0A%09%09%09%0A%09%09%09generator.initialize(1024);%0A%09%09%09kPair = generator.genKeyPair();%0A%09%09%09keys.add(0, kPair.getPublic());%0A%09%09%09keys.add(1, kPair.getPrivate());%0A%09%09%09%0A%09%09%09return (keys);%0A%09%09%7D %0A%09%09catch (NoSuchAlgorithmException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%09return (null);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static byte%5B%5D Encrypt(String message, Key publicKey) %7B%0A%09%09try %7B%0A%09%09%09byte%5B%5D %09%09encryptedMessage = null;%0A%09%09%09Cipher %09%09cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM);%0A%09%09      %0A%09%09%09cipher.init(Cipher.ENCRYPT_MODE, publicKey);%0A%09%09    encryptedMessage = cipher.doFinal(message.getBytes());%0A%09%09    return encryptedMessage;%0A%09%09%7D %0A%09%09catch (Exception e) %7B%0A%09%09    e.printStackTrace();%0A%09%09    return null;%0A%09%09%7D%0A%09%7D%0A%09%09%0A%09public static String Decrypt(byte%5B%5D cypher, Key privateKey) %7B%0A%09%09try %7B%0A%09%09%09String %09%09message = null;%0A%09%09%09Cipher %09%09cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM);%0A%09%09%09%0A%09%09%09cipher.init(Cipher.DECRYPT_MODE, privateKey);%0A%09%09%09message = new String(cipher.doFinal(cypher));%0A%09%09%09return message;%0A%09%09%7D%0A%09%09catch (Exception ex) %7B%0A%09%09%09ex.printStackTrace();%0A%09%09%09return null;%0A%09%09%7D%0A%09 %7D%0A%7D%0A

Add encryption class