(CConnection cc)
| 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"; } |
nothing calls this directly
no test coverage detected