I use AES key encrypt a file because RSA can't be use for encrypting long file.and use RSA encrypt the AES key.
but hwo to implement.
first i do like this.
javax.crypto.KeyGenerator keygen = javax.crypto.KeyGenerator
.getInstance("AES");
SecureRandom random = new SecureRandom();
keygen.init(random);
this.secretKey = keygen.generateKey();
Encriptor.encripteRSA(secretKey.getEncoded(),this.privateKey,CryAESFile);
the method Encriptor.encripteRSA 's job is use RSA encrypt the secretKey.getEncoded.but it does't work when i get back . complier tell me it is not a valid AES key.so what can i do.
thanks for any help.