Jon Eaves

+ Follow
since Apr 04, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jon Eaves

While I'm not 100% sure there is _no way_ to do this, it's been the only reliable way to make it work.

There are some instructions here that describe how to install a JCE and provider.

So, you might be lucky and be able to package the whole thing into a WAR.

However, I'm not a lawyer, nor do I play one on an Internet soap, but you might wish to seek legal advice about distributing your product with cryptography installed. This is a difficult area, and one that has been muddied considerably over the last couple of years.
17 years ago
If the file you've downloaded is bcprov.jar, then you need to have it in $JRE/lib/ext.
17 years ago

On the servlet I have the following line: Digest digest = new SHA1Digest();
I cannot compile because i get the following error: type mismatch cannot convert from SHA1Digest to Digest.

The SHA1Digest is a BC specific class. If you are going to use the light-weight library on both ends, then you can either import the correct Digest class or use the JCE equivalent ;

MessageDigest digest = MessageDigest.getInstance("SHA1", "BC");
17 years ago
Ignore the response that you got. They are wrong.

There's no such thing as Text or Image for the encryption algorithms provided by BouncyCastle. (or any other library that I am aware of)

It's just a bunch of byte[]. That's all that matters. So, just grab the bytes from the Image or String (in any way that you like) and then feed those bytes into the encryption algorithms.

Strings are generally used for examples, because it's easy to see, but you can trivially change the String.getBytes() to Image.getBytes() and that will work in exactly the same way.
17 years ago
I'm flattered that you think Sun does BouncyCastle, but the reality is somewhat distant.

Anyway, Google would have helped you, and you should be able to find all the BouncyCastle goodies at;

BouncyCastle Web Page
17 years ago
There is also KeyTool GUI, which is now KeyStore Explorer

You can find it here ;

Ouch, just looked, they now charge US$30 for it. Oh well.

It used to be free.
18 years ago
Don't ever, ever, ever convert encrypted data to a String. Encrypted data _isn't_ a bunch of characters, they are "random numbers" which cannot be converted to a text representation.

If you want to use it as a "string" then uuencode or base64 encode the data first.
18 years ago
I can't help with JODE, but I know that both ProGuard and Retroguard can be used very successfully with the BC libraries.
When you're developing with BC, the simplest way to work is to unpack the lw-api jar to somewhere sensible and then add that to your classpath.
Then when you create your MIDlet jar file, I create a tmp.jar first, then obfuscate to create my final version.
Here's the ant target that I use for this.

As you can see, you obfuscate, then preverify, then create the jar file.
If people are interested, contact me directly and I can send you the entire Ant build file (not that long)
18 years ago
Depending on what version of the library you are using this is either a bug or a feature.
There was a bug in the lightweight J2ME/MIDP BigInteger that would cause the prime generation to go into an infinite loop under some circumstances. This was introduced with the introduction of a speedup for the Montgomery number calculations.
However, it's been fixed in version 1.21. So, grab the latest release (1.23) and you should be fine. It will take ages to compute however. Now this has been fixed, I should do a test on my 7210 to see exactly how long.
18 years ago
Generally the approach is encrypted (for the security) and signed (for the authenticity).
Use a public key algorithm and have the two machines authenticate. Of course the actual answer depends heavily on what you're trying to do.
18 years ago
If you look at, you will find a JCE compatible provider and source code.
There is also a lot of examples and test code that shows how to perform many cryptographic operations.
If you join the mailing list, you'll find many people willing and able to help.
18 years ago
Make sure the zip file is unpacked so that when the MIDlet is created the relevant class files can be included in the MIDlet.
Of course, much of this depends on how you are packaging up your MIDlets, and I'm no expert in the WTK these days.
-- jon
18 years ago