Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. static String decryptAESData(String base64String, String key) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
  2.         SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES");
  3.         Cipher cipher = Cipher.getInstance("AES");
  4.         cipher.init(Cipher.DECRYPT_MODE, keySpec);
  5.         byte[] encryptedBytes = Base64.decodeBase64(base64String.getBytes());
  6.         byte[] decrypted = cipher.doFinal(encryptedBytes);
  7.         return new String(decrypted);
  8.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement