Avec cryptage AES-256 Java

J'ai ce code simple, que j'ai trouvé sur internet.. im apprentissage de ce genre de choses de chiffrement/déchiffrement.. ce code semble fonctionner très bien, mais je ne comprends pas quelque chose... pourquoi après la "c.doFinal()" (qui est pour crypter/décrypter avec AES-256) ce gars encoder/décoder valeur chiffrée, avec BASE64? ce n'est pas assez que par l'aide d'AES?

`private static final String ALGO = "AES";
private static final byte[] keyValue = 
new byte[] { 'T', 'h', 'e', 'B', 'e', 's', 't', 'S', 'e', 'c', 'r','e', 't', 'K', 'e', 'y' };
public static String encrypt(String Data) throws Exception {
Key key = generateKey();
Cipher c = Cipher.getInstance("AES");
c.init(Cipher.ENCRYPT_MODE, key);
byte[] encVal = c.doFinal(Data.getBytes());
String encryptedValue = new BASE64Encoder().encode(encVal);
return encryptedValue;
}
public static String decrypt(String encryptedData) throws Exception {
Key key = generateKey();
Cipher c = Cipher.getInstance(ALGO);
c.init(Cipher.DECRYPT_MODE, key);
byte[] decordedValue = new BASE64Decoder().decodeBuffer(encryptedData);
byte[] decValue = c.doFinal(decordedValue);
String decryptedValue = new String(decValue);
return decryptedValue;
}
private static Key generateKey() throws Exception {
Key key = new SecretKeySpec(keyValue, ALGO);
return key;
}
public static void main(String[] args) throws Exception {
String data = "SOME TEXT";
String dataEnc = AES.encrypt(data);
String dataDec = AES.decrypt(dataEnc);
System.out.println("Plain Text : " + data);
System.out.println("Encrypted Text : " + dataEnc);
System.out.println("Decrypted Text : " + dataDec);
}`

Merci!!

C'est en fait à l'aide de 128-bit AES, pas 256. La clé est de 16 octets; 16 octets * 8 bits par octet = 128 bits de la clé.

OriginalL'auteur Gerardo agustin Riera | 2013-08-21