BYTE chave[16]={ 1 , 0 ,0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0};
O problema é q o código criptografado em c é diferente do código criptografado em Java.
Se a Mensagem é a mesma e a chave também. Acho que isso teria q ser igual.
Se alguém entende do algoritmo AES pode me ajudar porque tem alguma coisa errada acontecendo.
// Get the KeyGenerator
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128); // 192 and 256 bits may not be available
// Generate the secret key specs.
//SecretKey skey = kgen.generateKey( );
// byte[] raw = skey.getEncoded( );
byte[] raw ={1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
SecretKeySpec skeySpec = new SecretKeySpec( raw , "AES" );
// Instantiate the cipher
Cipher cipher = Cipher.getInstance("AES");
cipher.init( Cipher.ENCRYPT_MODE , skeySpec );
byte[] encrypted = cipher.doFinal((args.length == 0 ?"ABC" : args[0]).getBytes());
System.out.println(new String(encrypted));
System.out.println("encrypted string: " + asHex(encrypted));
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] original =
cipher.doFinal(encrypted);
String originalString = new String(original);
System.out.println("Original string: " +
originalString + " " + asHex(original));