jmasterx
jmasterx

Reputation: 54143

Secure Server not working

The Lacewing library is supposed to support hosting a secure server.

It says if the certificate loads correctly, it should be secure. However, I'm hosting it and it says the certificate successfully loaded but when I send a message from client to server, I dont receive it. If a certificate is not loaded, I do.

#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->LoadSystemCertificate("MY","localhost");
        std::cout << server->CertificateLoaded();
        server->onReceive(onReceive);
        server->onConnect(onConnect);
        server->Host(1234);
        std::cout << server->CertificateLoaded();
        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;  
}  

Both times the certificate says it is loaded.

Here is the api docs. http://lacewing-project.org/docs/server/LoadSystemCertificate.html

Thanks

Maybe the certificate generated by makecert doesnt work? does anyone have a certificate I could try?

Upvotes: 1

Views: 369

Answers (1)

eFMer
eFMer

Reputation: 26

I'm trying the same thing.

bSecure = WebServer.LoadSystemCertificate("My", "localhost","localmachine");
bSecure = WebServer.CertificateLoaded();

Both are true, so the certificate should be loaded.

Look here: how to make a certificate

This works fine in IE9, port set to 5040. https://localhost:5040/ It doesn't work in Firefox or Chrome, but this has something to do with loading the "Certification Authority" certificate.

Upvotes: 1

Related Questions