@Test public void encrypt() { String data = "root1"; byte[] key = "1111111111111111".getBytes(); byte[] encryption = AES.encrypt(data.getBytes(), key); assertEquals(Base64.getEncoder().encodeToString(encryption), "8/mudtZ/bQOhcV/K6JFrug=="); String decryptData = new String(AES.decrypt(encryption, key)); assertEquals(decryptData, data); }
public static byte[] encrypt(byte[] data, byte[] key) { validation(data, key); Key secretKeySpec = Symmetry.generateRandomKey(key, AES_ALGORITHM); return Symmetry.encrypt(AES_ALGORITHM, secretKeySpec, data); }
AES { public static byte[] encrypt(byte[] data, byte[] key) { validation(data, key); Key secretKeySpec = Symmetry.generateRandomKey(key, AES_ALGORITHM); return Symmetry.encrypt(AES_ALGORITHM, secretKeySpec, data); } }
AES { public static byte[] encrypt(byte[] data, byte[] key) { validation(data, key); Key secretKeySpec = Symmetry.generateRandomKey(key, AES_ALGORITHM); return Symmetry.encrypt(AES_ALGORITHM, secretKeySpec, data); }  }
AES { public static byte[] encrypt(byte[] data, byte[] key) { validation(data, key); Key secretKeySpec = Symmetry.generateRandomKey(key, AES_ALGORITHM); return Symmetry.encrypt(AES_ALGORITHM, secretKeySpec, data); }  static byte[] encrypt(byte[] data, byte[] key); static byte[] decrypt(byte[] data, byte[] key); static void validation(byte[] data, byte[] key); }
AES { public static byte[] encrypt(byte[] data, byte[] key) { validation(data, key); Key secretKeySpec = Symmetry.generateRandomKey(key, AES_ALGORITHM); return Symmetry.encrypt(AES_ALGORITHM, secretKeySpec, data); }  static byte[] encrypt(byte[] data, byte[] key); static byte[] decrypt(byte[] data, byte[] key); static void validation(byte[] data, byte[] key);  }