Description: public static String encode(String in, String key) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
String hex = "";
byte[] bytIn = in.getBytes();
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] bytOut = cipher.doFinal(bytIn);
hex = byte2hexString(bytOut);
return hex;
}
To Search:
File list (Check if you may need any files):
Filename | Size | Date |
---|
AESUtil.java | 5436 | 2017-12-19 |