aspose file tools*
The moose likes Java in General and the fly likes javax.crypto with sun AND ibm... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "javax.crypto with sun AND ibm..." Watch "javax.crypto with sun AND ibm..." New topic
Author

javax.crypto with sun AND ibm...

Martin Herfurth
Greenhorn

Joined: Jun 08, 2009
Posts: 2
Hello together,

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?

Thanks in advance.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42600
    
  65
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.


Ping & DNS - my free Android networking tools app
Martin Herfurth
Greenhorn

Joined: Jun 08, 2009
Posts: 2
This works fine... no problems in this step. In prodictive code, i use encoding. I just dont want to have too much overhead in my example code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.crypto with sun AND ibm...