Paul Clapham wrote:
Right. So not only do you throw away all of the cipher text except the last line when you read it, when you write it you're appending an unnecessary line-end character.
But really your cipher text isn't a series of lines anyway, is it? It's just a series of characters. So you should really stop treating it as lines. Don't use any methods which write lines or read lines, just write all the characters to the file and then read them all back.