MCPcopy Create free account
hub / github.com/TigerVNC/tigervnc / processMsg

Method processMsg

java/com/tigervnc/rfb/CSecurityVncAuth.java:32–62  ·  view source on GitHub ↗
(CConnection cc)

Source from the content-addressed store, hash-verified

30 private static final int vncAuthChallengeSize = 16;
31
32 public boolean processMsg(CConnection cc)
33 {
34 InStream is = cc.getInStream();
35 OutStream os = cc.getOutStream();
36
37 // Read the challenge & obtain the user's password
38 ByteBuffer challenge = ByteBuffer.allocate(vncAuthChallengeSize);
39 is.readBytes(challenge, vncAuthChallengeSize);
40 StringBuffer passwd = new StringBuffer();
41 upg.getUserPasswd(cc.isSecure(), null, passwd);
42
43 // Calculate the correct response
44 byte[] key = new byte[8];
45 int pwdLen = passwd.length();
46 byte[] utf8str = new byte[pwdLen];
47 try {
48 utf8str = passwd.toString().getBytes("UTF8");
49 } catch(java.io.UnsupportedEncodingException e) {
50 e.printStackTrace();
51 }
52 for (int i=0; i<8; i++)
53 key[i] = i<pwdLen ? utf8str[i] : 0;
54 DesCipher des = new DesCipher(key);
55 for (int j = 0; j < vncAuthChallengeSize; j += 8)
56 des.encrypt(challenge.array(),j,challenge.array(),j);
57
58 // Return the response to the server
59 os.writeBytes(challenge.array(), 0, vncAuthChallengeSize);
60 os.flush();
61 return true;
62 }
63
64 public int getType() { return Security.secTypeVncAuth; }
65 public String description() { return "No Encryption"; }

Callers

nothing calls this directly

Calls 11

readBytesMethod · 0.95
encryptMethod · 0.95
writeBytesMethod · 0.95
flushMethod · 0.95
getBytesMethod · 0.80
getUserPasswdMethod · 0.65
getInStreamMethod · 0.45
getOutStreamMethod · 0.45
isSecureMethod · 0.45
lengthMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected