Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.security.MessageDigest encryption works differently on UNIX vs. Window

843811Sep 22 2005 — edited Sep 23 2005
We have an application, called X, that has two parts: An admin section and a Work section.

The Admin section uses the MessageDigest class tto encrypt a string (password) and store it in the database when a user/password is created. (The application was running on Windows XP Professional and running Websphere version 5.1.)

In the Work section of application X, a user must login and the string a user enters is encrypted and then compared against the value in the database. The two strings are compared and they both match on the Windows XP.

We moved the application (not changing any code) to UNIX running Websphere 5.1 and when the user logins in; it seems the passwords are not matching up. Now, if we update the user's password through Admin (now running on UNIX) - [the passwords will get reencrypted]; the user will be able to login (the passwords will match)

Based on this information; we're assuming the strings get encrypted differently on Windows versus UNIX. Does anyone know this to be true?

Here's the code:

try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.reset();
md.update(input.getBytes());
byte[] a = md.digest();
return (new String(a));
} catch (NoSuchAlgorithmException nsa) {
throw new IOException(nsa.toString());
}

Any insight is appreciated.
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 21 2005
Added on Sep 22 2005
3 comments
213 views