Re: An urgent question for JCE1.2

Jan Luehe (luehe@laguna.eng.sun.com)
Tue, 21 Jul 1998 11:50:05 -0700 (PDT)

Date: Tue, 21 Jul 1998 11:50:05 -0700 (PDT)
From: Jan Luehe <luehe@laguna.eng.sun.com>
Subject: Re: An urgent question for JCE1.2
To: java-security@java.Sun.COM, entezari@hotmail.com

Reza:

> 1. Your example in the API_Users_Guide just before the Diffie Hellman
> examples, the example that is encrypting "This is a simple text" and
> again decrypting it to the cleartext1 array and I just printed that
> cleartext1 out, but at the runtime only garbage is coming out of that
> code: [B@f84e34d2 or something like that.

Are you printing out your byte arrays using "toString"?
This does not print the contents of your byte arrays in
the form you wanted (or expected), but prints the unsigned hexadecimal
representation of the hashcode of your objects.

Please use the "toHexString" utility (included in API_users_guide.html)
to print the contents of your input/output byte arrays in
hexadecimal format. Then you'll notice that everything works fine.

> 2. Almost the same problem with the CipherInputStream and
> CipherOutputStream; they never worked properly. The only time that they
> seemed to work(not even properly) was that I was reading byte by byte
> using Cipher.read() method. the bytes that I was reading were totally
> non-sense.

See above.

Jan