internal static void process_authreq(RdpPacket data) { byte[] destinationArray = new byte[10]; byte[] outData = new byte[10]; byte[] buffer3 = new byte[20]; byte[] buffer4 = new byte[30]; byte[] signature = new byte[0x10]; RC4 rc = new RC4(); byte[] buffer6 = null; if (!parse_authreq(data)) { throw new RDFatalException("Authentication request is incorrect!"); } Array.Copy(RDPClient.m_In_Token, 0, destinationArray, 0, 10); buffer6 = new byte[RDPClient.m_LicenceKey.Length]; Array.Copy(RDPClient.m_LicenceKey, 0, buffer6, 0, RDPClient.m_LicenceKey.Length); rc.engineInitDecrypt(buffer6); rc.crypt(RDPClient.m_In_Token, 0, 10, outData, 0); byte[] sourceArray = generate_hwid(); Array.Copy(outData, 0, buffer4, 0, 10); Array.Copy(sourceArray, 0, buffer4, 10, 20); signature = Secure.sign(RDPClient.m_Licence_Sign_Key, 0x10, 0x10, buffer4, buffer4.Length); Array.Copy(RDPClient.m_LicenceKey, 0, buffer6, 0, RDPClient.m_LicenceKey.Length); rc.engineInitEncrypt(buffer6); rc.crypt(sourceArray, 0, 20, buffer3, 0); send_authresp(destinationArray, buffer3, signature); }
internal static void send_to_channel(RdpPacket sec_data, int flags, int channel) { sec_data.Position = 0L; byte[] buffer = new byte[sec_data.Length]; sec_data.Read(buffer, 0, buffer.Length); if ((RDPClient.enc_count == 0x1000) && Secure.RDPEncrypted()) { Secure.m_Encrypt_Key = Secure.update(Secure.m_Encrypt_Key, RDPClient._r); byte[] destinationArray = new byte[Secure.m_KeyLength]; Array.Copy(Secure.m_Encrypt_Key, 0, destinationArray, 0, Secure.m_KeyLength); RDPClient.m_RC4_Enc.engineInitEncrypt(destinationArray); RDPClient.enc_count = 0; } if (Secure.RDPEncrypted()) { byte[] buffer3 = Secure.sign(RDPClient.m_Sec_Sign_Key, 8, Secure.m_KeyLength, buffer, buffer.Length); byte[] buffer4 = RDPClient.m_RC4_Enc.crypt(buffer); sec_data = new RdpPacket(); sec_data.WriteLittleEndian32(flags); sec_data.Write(buffer3, 0, buffer3.Length); sec_data.Write(buffer4, 0, buffer4.Length); } else { flags &= -9; sec_data = new RdpPacket(); if (flags != 0) { sec_data.WriteLittleEndian32(flags); } sec_data.Write(buffer, 0, buffer.Length); } SendMCS(sec_data, channel); RDPClient.enc_count++; }