Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Decrypting creates some garbled characters, 8 in a row

843810Jan 26 2002 — edited Feb 6 2002
I give up trying to figure this out. Any help would be apppreciated.

I am using this class to encrypt/decrypt:
http://www.infinity-design.com/code/Blowfish.java

Occaionally the decrypted data will contain garbled characters, occuring 8 in a row. It seems to depend on what key data is used.

Try this code and you will see what I mean:
try{
	Security.addProvider(new com.sun.crypto.provider.SunJCE());
	String data = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789";
	String keydata = "BW6v589SIg3i3zaEW47RcMZ+I+M=";

	System.out.println("Encrypting data: " + data);
	String encrypted = Blowfish.encrypt(data,keydata);
	String decrypted = Blowfish.decrypt(encrypted,keydata);
	System.out.println("Decrypted data:  " + decrypted);
}catch(Exception ex){
	System.out.println(ex.getMessage());
}
If the key changes the garbage chars go away and everything works.

Any ideas?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2002
Added on Jan 26 2002
2 comments
232 views