This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
this is my first post here and hopefully my last ;-)
I hope anyone can help me a little bit with javas crypto stuff.
I am going to use a Password based encryption for normal strings. I like to use an AES algorithm to encrypt my data. Therefore i use a PBKDF2 Algorithm to genereate a suitable secret key. That results in the following code:
I figured out the on ibm there is just a PBKDF1 and PBKDF2 available. So now i can make my code intelligent enough to decide which algorithm it has tu use, but depending on the fact that some data my encrypted on a sun, stored in the database, and will be encrypted on an ibm, i am not sure if i can mix this up.
I really like to use this AES with this length and salt, so i can only change the algorithm to generate the key. Any ideas?
This has nothing to do with the problem at hand, but "string.getBytes()" is bound to fail if you move code or data across machines, since it relies on the platform default encoding. Better to use a specific encoding explicitly.