PDA

Click to See Complete Forum and Search --> : AES (Rijndael) Java class


Cheeseball
January 11th, 2003, 09:30 AM
I am working on a chat client that using AES (Rijndael) in Java, I am needing to verify my "assumptions" for the specs on Rijndael. I have attached some source if anyone wants to take a look, it is not optimized (to any extent) and only gets about 1.7k throughput. I have only posted the class that is used to encrypt/decrypt data, no classes that actually use it.

In order to use it you will need to have a program create a new RijnCrypto object, then invoke the encrypt(String, String) method, to decrypt data you will need to call the decrypt(String, String) method. I have included a simple example main method.


static int charsread;
static char data[];
public static void main(String args[]) {
RijnCrypto rijn = new RijnCrypto(128, 128);

String filename = "test.txt";
try {
FileReader filereader = new FileReader(filename);
data = new char[400000];

charsread = filereader.read(data);

filereader.close();
} catch (Exception e) {
System.out.println(e);
}

String d = new String(data, 0, charsread);

double i;
double j;
System.out.println("Start crypt: ");

i = System.currentTimeMillis();
rijn.encrypt(d, "aaaaaaaaaaaaaaaa");
j = System.currentTimeMillis();

double x = j - i;
System.out.println("Stop crypt, took: " + x + "ms");
}



I am looking for flaws with the code itself, and it also makes a good reference piece for people who want to know how rijndael works.

Thanks

sourceforge.net/sicher (http://sourceforge.net/sicher)

proactive
January 11th, 2003, 04:47 PM
Looks good! I'm no Rijndael expert, but on the NIST homepage I found two links, one with a C++ implementation, http://fp.gladman.plus.com/cryptography_technology/rijndael/
and a cgi-app for testing Rijndael on the web. http://aes.crockatt.com/

I bet you have seen these before, but in case you haven't, you could compare your code to the C++ code and test your output in the cgi-app.