During a project dealing with encryption and decryption in password
based encryption, I'm facing a problem while reading a Byte array.
When the size of the string input during the encryption is small then
both the decryption and the string shown are correct but when the
string is large it shows error.
byte[] textTranslated = pbeCipher.doFinal(textInBytes);
return new String(textTranslated);
by using this code i'm not getting the full string when its large.
So tell me how to convert a byte array to string and read
successfully.
Pls Help. Thanx in advance.
Andrew Thompson - 11 Apr 2007 18:29 GMT
>During a project dealing with encryption and decryption in password
>based encryption, I'm facing a problem while reading a Byte array.
>When the size of the string input during the encryption is small then
>both the decryption and the string shown are correct but when the
>string is large it shows error.
Would that be a TimeTurnsKittensIntoCatsError?
Or would you just like us to guess?
<http://www.physci.org/codes/javafaq.html#exact>

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Martijn - 11 Apr 2007 18:41 GMT
To answer the question in your subject:
Simply use the appropriate String constructor. But be aware of code pages
and the sorts.
More details here:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#String(byte[])

Signature
Martijn
http://www.sereneconcepts.nl