public byte[] encrypt(String plaintext) { try { byte[] ciphertext = e.doFinal(plaintext.getBytes("UTF-8")); return ciphertext; } catch (Exception e) { e.printStackTrace(); } return null; } public String decrypt(byte[] ciphertext) { try { byte[] plaintext = d.doFinal(ciphertext); return new String(plaintext, "UTF-8"); } catch (Exception e) { e.printStackTrace(); } return null; }