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:
So far so good. Works amazing on my local machine with sun java 1.5.0_13. But running on a server which uses ibm java i get a java.security.NoSuchAlgorithmException: Algorithm PBKDF2WithHmacSHA1 not available.
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.