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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Equivalent code in JCE for the given C# AES code

843811Mar 13 2006 — edited Mar 14 2006
Can somebody give me the equivalent code in JCE for the given C# AES code below?
(Ofcourse, I checked this topic
http://forum.java.sun.com/thread.jspa?threadID=603209
as well, but couldn't figure out much; I have
little knowledge in this area; I've a job to figure out an equivalent code for
this and use it in JSP.)

Thanks,
RK.

byte[] bytesToEncrypt = ASCIIEncoding.ASCII.GetBytes(stringToEncrypt);
//RijndaelManaged uses AES and defaults to CBC mode
RijndaelManaged rij = new RijndaelManaged();
rij.KeySize = 128;
ICryptoTransform encryptor = rij.CreateEncryptor(
                 Convert.FromBase64String("7inEMafSQqaSANhMe92Gdw=="), initializationVectorBytes );
byte[] encryptedBytes = encryptor.TransformFinalBlock(bytesToEncrypt, 0, bytesToEncrypt.Length);
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 11 2006
Added on Mar 13 2006
1 comment
219 views