1
0

PolarSSL is fully used for 1.3.2 protocol encryption.

This commit is contained in:
madmaxoft
2014-01-23 23:35:23 +01:00
parent 9774da8122
commit 5f34c78091
13 changed files with 630 additions and 157 deletions

View File

@@ -284,17 +284,9 @@ int cServer::GetNumPlayers(void)
void cServer::PrepareKeys(void)
{
// TODO: Save and load key for persistence across sessions
// But generating the key takes only a moment, do we even need that?
LOGD("Generating protocol encryption keypair...");
time_t CurTime = time(NULL);
CryptoPP::RandomPool rng;
rng.Put((const byte *)&CurTime, sizeof(CurTime));
m_PrivateKey.GenerateRandomWithKeySize(rng, 1024);
CryptoPP::RSA::PublicKey pk(m_PrivateKey);
m_PublicKey = pk;
VERIFY(m_PrivateKey.Generate(1024));
m_PublicKeyDER = m_PrivateKey.GetPubKeyDER();
}