| 2129 | |
| 2130 | |
| 2131 | void cProtocol172::StartEncryption(const Byte * a_Key) |
| 2132 | { |
| 2133 | m_Encryptor.Init(a_Key, a_Key); |
| 2134 | m_Decryptor.Init(a_Key, a_Key); |
| 2135 | m_IsEncrypted = true; |
| 2136 | |
| 2137 | // Prepare the m_AuthServerID: |
| 2138 | cSHA1Checksum Checksum; |
| 2139 | const AString & ServerID = cRoot::Get()->GetServer()->GetServerID(); |
| 2140 | Checksum.Update((const Byte *)ServerID.c_str(), ServerID.length()); |
| 2141 | Checksum.Update(a_Key, 16); |
| 2142 | Checksum.Update((const Byte *)cRoot::Get()->GetServer()->GetPublicKeyDER().data(), cRoot::Get()->GetServer()->GetPublicKeyDER().size()); |
| 2143 | Byte Digest[20]; |
| 2144 | Checksum.Finalize(Digest); |
| 2145 | cSHA1Checksum::DigestToJava(Digest, m_AuthServerID); |
| 2146 | } |
| 2147 | |
| 2148 | |
| 2149 | |