mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +00:00
Use UTF-8 when converting password strings to bytes for hashing to MD5.
This commit is contained in:
committed by
Michael Jumper
parent
958eedb76b
commit
30e786e589
@@ -1,5 +1,6 @@
|
|||||||
package net.sourceforge.guacamole.net.basic.auth;
|
package net.sourceforge.guacamole.net.basic.auth;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -195,9 +196,12 @@ public class Authorization {
|
|||||||
// Compare hashed password
|
// Compare hashed password
|
||||||
try {
|
try {
|
||||||
MessageDigest digest = MessageDigest.getInstance("MD5");
|
MessageDigest digest = MessageDigest.getInstance("MD5");
|
||||||
String hashedPassword = getHexString(digest.digest(password.getBytes()));
|
String hashedPassword = getHexString(digest.digest(password.getBytes("UTF-8")));
|
||||||
return hashedPassword.equals(this.password.toUpperCase());
|
return hashedPassword.equals(this.password.toUpperCase());
|
||||||
}
|
}
|
||||||
|
catch (UnsupportedEncodingException e) {
|
||||||
|
throw new UnsupportedOperationException("Unexpected lack of UTF-8 support.", e);
|
||||||
|
}
|
||||||
catch (NoSuchAlgorithmException e) {
|
catch (NoSuchAlgorithmException e) {
|
||||||
throw new UnsupportedOperationException("Unexpected lack of MD5 support.", e);
|
throw new UnsupportedOperationException("Unexpected lack of MD5 support.", e);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user