• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javax.crypto different in Linux and Windows?

 
Emili Calonge
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The two platforms most likely have different default encodings, so that the getBytes() method returns different values. Try using the getBytes(String) method instead.
 
Emili Calonge
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic