Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm using a TCP Client Server Library called Lacewing.

http://lacewing-project.org/docs/

What I noticed is that messages I send and receive are in plain text. Is there a way to encrypt / decrypt the messages easily given that I use TCP? How could I add something like TLS en.wikipedia.org/wiki/Transport_Layer_Security or similar?

Thanks

The library is pretty high level but here is client server in a nutshell:

#include <string>
#include <iostream>  
#define  LacewingFunction
#include "Lacewing.h"

void onReceive (Lacewing::Server &Server, Lacewing::Server::Client &Client,
                char * Data, int Size) {
                    /* callback body */
                    std::cout << Data << "\n";
}

void onConnect (Lacewing::Server &Server, Lacewing::Server::Client &Client)
{
    std::cout << "Connected!" << "\n";
    Client.Send("TestingS");
}



void onReceiveC (Lacewing::Client &Client, char * Data, int Size)
{
    std::cout << Data << "\n";
    Client.Send("TesingC");
}


int main(int argc, char* argv[])  
{  
    std::string s;
    std::cin >> s;
    if(s == "server")
    {
        Lacewing::EventPump pump;
        Lacewing::Server* server = new Lacewing::Server(pump);
        server->onReceive(onReceive);
        server->onConnect(onConnect);
        server->Host(1234);
        pump.StartEventLoop();
    }
    else
    {
        Lacewing::EventPump pump;
        Lacewing::Client* server = new Lacewing::Client(pump);
        server->onReceive(onReceiveC);
        server->Connect("192.168.2.12",1234);
        pump.StartEventLoop();
    }

    return 0;  
}  

If I have too, I can modify the Lacewing source code to use SSL. I just do not know how.

share|improve this question

closed as off topic by Tetrad May 14 '12 at 15:52

Questions on Game Development Stack Exchange are expected to relate to game development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
TLS/SSL is pretty complicated; I would advise you to use a third-party library for it. You might find one that can work on top of Lacewing, or you might need to find a new TCP library. It might not hurt to ask the Lacewing devs how to best add TLS support. –  stephelton May 14 '12 at 3:34
    
This question is off topic for this site (as it's not game development specific), and you cross posted it to SO. stackoverflow.com/questions/10576301/… –  Tetrad May 14 '12 at 15:52

Browse other questions tagged or ask your own question.