diff options
Diffstat (limited to 'java/src/com/tigervnc/rfb/CSecurityVncAuth.java')
-rw-r--r-- | java/src/com/tigervnc/rfb/CSecurityVncAuth.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/java/src/com/tigervnc/rfb/CSecurityVncAuth.java b/java/src/com/tigervnc/rfb/CSecurityVncAuth.java index f047f530..75673d51 100644 --- a/java/src/com/tigervnc/rfb/CSecurityVncAuth.java +++ b/java/src/com/tigervnc/rfb/CSecurityVncAuth.java @@ -41,8 +41,14 @@ public class CSecurityVncAuth extends CSecurity { // Calculate the correct response
byte[] key = new byte[8];
int pwdLen = passwd.length();
+ byte[] utf8str = new byte[pwdLen]; + try { + utf8str = passwd.toString().getBytes("UTF8"); + } catch(java.io.UnsupportedEncodingException e) { + e.printStackTrace(); + } for (int i=0; i<8; i++)
- key[i] = i<pwdLen ? (byte)passwd.charAt(i) : 0;
+ key[i] = i<pwdLen ? utf8str[i] : 0;
DesCipher des = new DesCipher(key);
for (int j = 0; j < vncAuthChallengeSize; j += 8)
des.encrypt(challenge,j,challenge,j);
|