java - Encrypt and Decrypt a String with RSA -
i new bee java security , crypto. below code not return me correct decryption. also please let me know recommendation using algorithm make strong key. below code has 2 methods 1 encryption string , other decryption. public class testsecuritydiscussions { public static byte[] encryptdata(keypair keys){ string rawdata = "hi how you>?"; cipher cipher = cipher.getinstance("rsa"); try { cipher.init(cipher.encrypt_mode, keys.getpublic()); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } byte[] encrypted = cipher.dofinal(rawdata.getbytes()); return encrypted; } public static string decryptdata(byte[] encrypted,keypair keys) { cipher cipher = cipher.getinstance("rsa"); try { cipher.init(cipher.decrypt_mode, keys.getprivat...