Soumyajit Hazra wrote:Giving you a very basic example of encode and decode a string using AES. .
Soumyajit Hazra wrote:I appreciate your thorough analysis of the code James.But regarding point 2 I must say it's a mere example not a production code and when we have to write code related to security it's like commonsense that not to put any such string hard coded in the source code. I'll keep in mind all of your point what you have suggested for betterment of the code.And I clearly mentioned this code is encoding a string not a file. It's only to give a idea because often after seeing a code only we understand what exactly we need to achieve.
Soumyajit Hazra wrote:I am completely agreed with you James. I will keep in mind your advise from next time.Please provide some links where it give some proper idea about file encryption. I searched in google but most of the example are with strings only not for entire file.
James Sabre wrote:3) The obvious implementation flaw is that the platform default character encoding is being used to turn the cleartext String into bytes. The default character encoding may not be able to completely represent all the characters in the String and it depends on the platform, locale and Java version being used. This means the the resultant ciphertext file may not be decipherable on some computers.