aspose file tools
The moose likes Security and the fly likes will Rijndael run in Electronic Code Book mode ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of RabbitMQ in Depth this week in the Open Source forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "will Rijndael run in Electronic Code Book mode ?" Watch "will Rijndael run in Electronic Code Book mode ?" New topic

will Rijndael run in Electronic Code Book mode ?

Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
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.

"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42956
Not an answer to your question, but instead of using the Cryptix provider I'd go with 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

Joined: Sep 17, 2006
Posts: 1282
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

Joined: Sep 12, 2004
Posts: 290

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.


Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
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

Joined: Sep 17, 2006
Posts: 1282
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 ]
I agree. Here's the link:
subject: will Rijndael run in Electronic Code Book mode ?