From 323285a9317ee6dd7121e736f72b1411c257e217 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 8 Apr 2013 13:04:20 +0000 Subject: [PATCH] moved temp hard coded key out of crypto class. --- src/lib/client/CClient.cpp | 8 +++++++- src/lib/server/CClientListener.cpp | 8 +++++++- src/lib/synergy/CCryptoStream.cpp | 6 ------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/lib/client/CClient.cpp b/src/lib/client/CClient.cpp index 0babb949..93ab9cff 100644 --- a/src/lib/client/CClient.cpp +++ b/src/lib/client/CClient.cpp @@ -35,6 +35,10 @@ #include "CArch.h" #include "IPlatformScreen.h" #include "CCryptoStream.h" + +// TODO: these are just for testing -- make sure they're gone by release! +const byte g_key[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; +const byte g_iv[] = "aaaaaaaaaaaaaaa"; // // CClient @@ -149,7 +153,9 @@ CClient::connect() m_stream = new CPacketStreamFilter(m_stream, true); if (s_cryptoEnabled) { - m_stream = new CCryptoStream(*EVENTQUEUE, m_stream, true); + CCryptoStream* cryptoStream = new CCryptoStream(*EVENTQUEUE, m_stream, true); + cryptoStream->setKeyWithIV(g_key, sizeof(g_key), g_iv); + m_stream = cryptoStream; } // connect diff --git a/src/lib/server/CClientListener.cpp b/src/lib/server/CClientListener.cpp index 5c6487ae..60bc6ffe 100644 --- a/src/lib/server/CClientListener.cpp +++ b/src/lib/server/CClientListener.cpp @@ -29,6 +29,10 @@ #include "IEventQueue.h" #include "TMethodEventJob.h" #include "CCryptoStream.h" + +// TODO: these are just for testing -- make sure they're gone by release! +const byte g_key[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; +const byte g_iv[] = "aaaaaaaaaaaaaaa"; // // CClientListener @@ -146,7 +150,9 @@ CClientListener::handleClientConnecting(const CEvent&, void*) stream = new CPacketStreamFilter(stream, true); if (s_cryptoEnabled) { - stream = new CCryptoStream(*EVENTQUEUE, stream, true); + CCryptoStream* cryptoStream = new CCryptoStream(*EVENTQUEUE, stream, true); + cryptoStream->setKeyWithIV(g_key, sizeof(g_key), g_iv); + stream = cryptoStream; } assert(m_server != NULL); diff --git a/src/lib/synergy/CCryptoStream.cpp b/src/lib/synergy/CCryptoStream.cpp index ce661841..e0dc8d3c 100644 --- a/src/lib/synergy/CCryptoStream.cpp +++ b/src/lib/synergy/CCryptoStream.cpp @@ -20,12 +20,6 @@ #include #include -// TODO: these are just for testing -- make sure they're gone by release! -const byte g_key1[] = "aaaaaaaaaaaaaaa"; -const byte g_key2[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; -const byte g_iv1[] = "aaaaaaaaaaaaaaa"; -const byte g_iv2[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - using namespace CryptoPP; CCryptoStream::CCryptoStream(IEventQueue& eventQueue, synergy::IStream* stream, bool adoptStream) :