Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to encrypt a AES key with RSA

843811Nov 10 2005 — edited Nov 22 2005
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 20 2005
Added on Nov 10 2005
7 comments
361 views