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!

Eu w/Japanese Win2K can't enter password

843810Dec 3 2004 — edited Dec 8 2004
I haven't been able to debug this issue yet. I was just wondering if someone already knew what this might be. Maybe some kind of character set issue?

A couple Japanese End Users are failing my one-way hash password protected application even though they are entering the same English password as everyone else.

The code looks like this:
      char[] passwordAttempt = edtPassword.getPassword();
      byte[] digest = new byte[0];
      try {
         MessageDigest algorithm = MessageDigest.getInstance("SHA-1");
         algorithm.reset();
         byte[] bytes = new byte[passwordAttempt.length];
         for (int j = 0; j < passwordAttempt.length; j++) {
            bytes[j] = (byte)passwordAttempt[j];
         }
         algorithm.update(bytes);
         digest = algorithm.digest();
      } catch (NoSuchAlgorithmException nsae) {
         Trace.ex(nsae);
      }

      passwordValid = true;
      if(digest.length != password.length) {
         passwordValid = false;
      }
      else {
         for(int i = 0; i < digest.length; i++) {
            if (digest[i] != password) {
passwordValid = false;
break;
}
}
}
This code works fine on all the English-based pc's. I do know that no exceptions are being thrown.

Any suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 5 2005
Added on Dec 3 2004
4 comments
111 views