Looks pretty good. Are you resetting/initializing the cipher object for every message? You probably don't want to do that, but if you do then you need to think carefully about the structure of the cipher file, because the decryptor needs to know where the message boundaries are.
Not for every message, but I think there are some cases where the cipher is reinitialized. It shouldn't be a problem if the key, IV, algorithm, block cipher mode and padding weren't changed, right? (just like example code above) – ordinarydot Jul 7 at 15:58 1 It is a problem.To simplify greatly, the "IV" you need to use is different for different positions in the cipher stream.
See the wikipedia page for details – GregS Jul 7 at 23:53 Thanks for reply. Hm, I thought it would work if I use the same IV, it was only for testing anyway. But if it must be different, that would make everything more complicated I guess.
I must write the IV in the file, add message delimiter, etc. What about the padding that didn't work? Do you have any clue? – ordinarydot Jul 8 at 3:39 @ordinarydot: I agree, using separate message entities is much more complicated.
The NoPadding works fine, the problem is almost certainly entirely due to reseting the the cipher instance. – GregS Jul 8 at 10:44 It's already working now. I took a different approach though.
Now I extends all the classes to log4j's WriteAppender and then I simply put all the encryption and encoding directly in the writers. Dealing with CipherOutputStream with no knowledge what's going on is too much I guess. Now I used AES/ECB/PKCS5Padding but I plan to change it to CBC.
Use different IV for each message and add necessary changes. Well, thanks a lot Greg, for all the help. – ordinarydot Jul 8 at 14:33.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.