summaryrefslogtreecommitdiffstats
path: root/source/cServer.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/cServer.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/cServer.cpp b/source/cServer.cpp
index 330a69873..157de2388 100644
--- a/source/cServer.cpp
+++ b/source/cServer.cpp
@@ -241,6 +241,8 @@ bool cServer::InitServer( int a_Port )
m_NotifyWriteThread.Start(this);
+ PrepareKeys();
+
return true;
}
@@ -283,6 +285,22 @@ cServer::~cServer()
+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?
+
+ LOG("Generating protocol encryption keypair...");
+ CryptoPP::AutoSeededRandomPool rng;
+ m_PrivateKey.GenerateRandomWithKeySize(rng, 1024);
+ CryptoPP::RSA::PublicKey pk(m_PrivateKey);
+ m_PublicKey = pk;
+}
+
+
+
+
+
void cServer::BroadcastChat(const AString & a_Message, const cClientHandle * a_Exclude)
{
cCSLock Lock(m_CSClients);