mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	Use UTF-8 when converting password strings to bytes for hashing to MD5.
This commit is contained in:
		
				
					committed by
					
						 Michael Jumper
						Michael Jumper
					
				
			
			
				
	
			
			
			
						parent
						
							958eedb76b
						
					
				
				
					commit
					30e786e589
				
			| @@ -1,5 +1,6 @@ | ||||
| package net.sourceforge.guacamole.net.basic.auth; | ||||
|  | ||||
| import java.io.UnsupportedEncodingException; | ||||
| import java.security.MessageDigest; | ||||
| import java.security.NoSuchAlgorithmException; | ||||
| import java.util.Map; | ||||
| @@ -195,9 +196,12 @@ public class Authorization { | ||||
|                     // Compare hashed password | ||||
|                     try { | ||||
|                         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()); | ||||
|                     } | ||||
|                     catch (UnsupportedEncodingException e) { | ||||
|                         throw new UnsupportedOperationException("Unexpected lack of UTF-8 support.", e); | ||||
|                     } | ||||
|                     catch (NoSuchAlgorithmException e) { | ||||
|                         throw new UnsupportedOperationException("Unexpected lack of MD5 support.", e); | ||||
|                     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user