Bouncy Castle provider problems
843810Mar 17 2004 — edited Mar 18 2004I just downloaded the Bouncy Castle Provider (version 122) for JDK1.4, placed the jar in the <JRE_PATH>/lib/ext directory. I edited the <JRE_PATH>/lib/security/java.security file to statically include the provider and it shows up as being an available provider. I am using Eclipse in Windows for my development and, since making these changes I seem to have broken all of the providers. While they still show up, I get a NoSuchAlgorithmException on the following line of code whether I'm trying to use "AES", "DES", or any other algorithm.
keyGen = KeyGenerator.getInstance(confidentialityAlgorithm);
I tried to roll back my changes to see what step broke everything but even when I remove the bouncy castle jar from the classpath and java.security file, it still doesn't find any algorithms.
I have tried compiling and running the code under Linux (in this case, the bouncy castle jar is just in my working directory and I manually put it into the -classpath part of my commands) and I get a different problem. I never get the exception related to the algorithm not existing, but elsewhere in the code I get a different exception.
The code is:
wrapper = Cipher.getInstance(confidentialityAlgorithm);
wrapper.init(Cipher.WRAP_MODE, keyVault.getMyPersonalKey()); - the line where the exception actually occurs
The exception is:
java.lang.IllegalArgumentException: Key length not 128/192/256 bits.
I initialize the key generator to make keys of 128 bits, so this should not be the case. Unfortunately, I can't debug this problem because when I try to run the code in Eclipse it won't even let me create the keys to begin with.
Does anybody have any ideas for (1) What I am doing wrong in my configuration of Bouncy Castle for my Windows machine and (2) What is going on when I run the code in Linux that makes it think the key is not 128 bits?
Thank you,
Josh