File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

will Rijndael run in Electronic Code Book mode ?

 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this a valid line of code ?


In other words, will Rijndael encipher in Electronic Code Book mode ?

This is my first non-trivial effort, the books jump from intro to advanced without much in the bracket where I need it.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an answer to your question, but instead of using the Cryptix provider I'd go with http://www.bouncycastle.org/ or the AES implementation of JCE itself. (Rijndael became AES, but I'm sure you know that already.)

This page suggests that the JCE implementation can use AES combined with ECB.
[ March 11, 2008: Message edited by: Ulf Dittmer ]
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At my current skill level, I picked the Cryptix provider because I liked the name better. I unpacked all the sources because I can copy-paste faster from them than from the api-docs, which run somewhat lumpy to me because of running in the browser. It is my personal opinion that the naming of the providers reflects political leanings and I would like to stay with Crypt Ticks. Their docs state NoPadding and None, the page you cite uses PKCS7Padding ECB does not need padding, does it ? At least not if it runs one byte at a time, which was my understanding from reading the provided examples.

The last html page I read from Sun plainly claims AES and so on are now avaiable without loading third party libs. I wanted to use ECB/NoPadding because it fits my understanding at the moment, I am trying to get into all the Prime Number Generation / Vol 4 Knuth and everything but that is slow trudgery for me now. Use of the AES implementation of JCE itself. suits my needs well, I just used the Cryptix because when I got to being able to code my first DES-56 ( I mean really first ) that was where I was able to read an example and copy-paste directly from source code.

I kinda like the Cryptix comments better also. I changed the name from AES to "Rijndael" as a consequence of reading this week that AES is Rijndael - not because I knew what difference it would make. I had sample code that accepted the algorithm name Rijndael, could not find "AES" the provided sources. Let me clarifiy I should be doing 32-bit beginner shift/XOR right now ~ I am going to 2048/AES because the people who will be reviewing the code will not take me seriously with any less.
 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nicholas,
I have used both with BC and works fine.

Cipher cipher = Cipher.getInstance("Rijndael/ECB/NoPadding", "BC");

as well as

Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding", "BC");

And as expected the output is same.

Aryan
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Mr. Kahn, this provides me enough confidence to get on with some other areas of work that will eventually rely on this.

I will wrap this in exception handling, and assume as always that this must be used as part of a cross-locked interworking of controls.
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I resorted to editing the policy files to get something to run. I expanded the exception handling and it appears that the edited code runs to completion without throwing.

Policy files look like this:
( tried a build - seems to run )


Code looks like this: {edited 3/22/2008}


I have tried SUN, SunJCE, AES, Rijndael, NoPadding, PKCS5Padding .....
{edited code appears to run}
The only thing I have been able to get running is posted here in the edited code.

I would like to hear any comments.
[ March 22, 2008: Message edited by: Nicholas Jordan ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic