| 2123 | |
| 2124 | |
| 2125 | void CUpDownClient::ProcessPublicKeyPacket(const uint8_t* pachPacket, uint32 nSize) |
| 2126 | { |
| 2127 | theApp->clientlist->AddTrackClient(this); |
| 2128 | |
| 2129 | wxCHECK2(m_socket != NULL, return); |
| 2130 | wxCHECK2(credits != NULL, return); |
| 2131 | if (pachPacket[0] != nSize - 1) { |
| 2132 | AddDebugLogLineN(logClient, CFormat("Inconsistent packet size (%d != %d)") % pachPacket[0] % (nSize - 1)); |
| 2133 | return; |
| 2134 | } |
| 2135 | if (nSize == 0) { |
| 2136 | AddDebugLogLineN(logClient, "Invalid packet size (0)"); |
| 2137 | return; |
| 2138 | } |
| 2139 | if (nSize > 250) { |
| 2140 | AddDebugLogLineN(logClient, CFormat("Invalid packet size (%d > 250)") % nSize); |
| 2141 | return; |
| 2142 | } |
| 2143 | if (!theApp->CryptoAvailable()) |
| 2144 | return; |
| 2145 | // the function will handle everything (multiple key etc) |
| 2146 | if (credits->SetSecureIdent(pachPacket+1, pachPacket[0])){ |
| 2147 | // if this client wants a signature, now we can send him one |
| 2148 | if (m_SecureIdentState == IS_SIGNATURENEEDED){ |
| 2149 | SendSignaturePacket(); |
| 2150 | } |
| 2151 | else if (m_SecureIdentState == IS_KEYANDSIGNEEDED) { |
| 2152 | // something is wrong |
| 2153 | AddDebugLogLineN( logClient, "Invalid State error: IS_KEYANDSIGNEEDED in ProcessPublicKeyPacket" ); |
| 2154 | } |
| 2155 | } else { |
| 2156 | AddDebugLogLineN( logClient, "Failed to use new received public key" ); |
| 2157 | } |
| 2158 | } |
| 2159 | |
| 2160 | |
| 2161 | void CUpDownClient::ProcessSignaturePacket(const uint8_t* pachPacket, uint32 nSize) |
no test coverage detected