MCPcopy Create free account
hub / github.com/cuberite/cuberite / StartEncryption

Method StartEncryption

src/Protocol/Protocol17x.cpp:2131–2146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2129
2130
2131void 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

Callers

nothing calls this directly

Calls 6

GetServerMethod · 0.80
c_strMethod · 0.80
sizeMethod · 0.80
FinalizeMethod · 0.80
InitMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected