aspose file tools*
The moose likes Java in General and the fly likes javax.crypto different in Linux and Windows? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "javax.crypto different in Linux and Windows?" Watch "javax.crypto different in Linux and Windows?" New topic
Author

javax.crypto different in Linux and Windows?

Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
Hi all,

I'm developing somne app and I've got two computers, one uses Windows and the other uses Linux. The thing is that I have to autenticate users using a database and I use javax.crypto to crypt the passwords.

In windows I can create users and then autenticate them, in Linux, I can create users but they never autneticate. I have to think that the problem is related with the crypto functions behaviour under different os's. Is that possible?

my code to encode the password is the following:

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
The two platforms most likely have different default encodings, so that the getBytes() method returns different values. Try using the getBytes(String) method instead.


Ping & DNS - my free Android networking tools app
Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
I suppose you're right, but I can't manage to fix it. I've tried using getBytes("UTF-8"); but it doesn't work either.

The thing is really strange though. In linux it doesn't work if I create a new user and I try to log in with it. And the password encryption is made on linux, so it should be the same, but it's not... I don't get it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.crypto different in Linux and Windows?