The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


discrepancy in decryption when two encrypted strings are appended

Posted by Saif on July 05, 2001 at 8:49 AM


i'm facing a peculiar problem. i need to encrypt two different strings using the same key, then concatinate the encrypted strings. later i read the number of encrypted bytes of the first string from the concatinated string and decrypt it using the same key. the decryption yields only part of the original string the rest is garbage.

on the other hand if i decrypt the first string without concatinating it, it yields the original string.

so the problem lies in concatinating the two encrypted strings, which i do using the StringBuffer class and FileInputStreams.

can someone help me out with this ?

i hope there is no ambiguity in understanding the problem...if so please contact me at




Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us