[Libwebsockets] PEM Certificates SSL

Carles Fontanella Bonjoch cfontanellab at cirsa.com
Thu May 15 09:42:53 CEST 2014


Hello!

My name is Carles and I'm using your library embedded in my c++ code. First of all, congratulations for your work, the library is excellent and very useful.
I have no problems to use the library without ssl, but when I want to put SSL and PEM certificates, something is wrong with my PEM certificates. With PEM certificate and KEY from the example, it works, but if I want to use my CA, my PEM and my KEY, created as usual by openssl, it doesn't work.
I don't know why, but I can use my PEM certificates with another webservers and I have no problems. My question is, can you tell me how are generating the certificate and key files?

The error message that library prints is :

[1400139725:7274] NOTICE: Client connecting to 10.16.69.135:7681....
[1400139725:7275] NOTICE: Client connected to 10.16.69.135:7681
[1400139725:7462] ERR: server's cert didn't look good 20

########################################################3
In the server part  :

     if (use_ssl)
     {
           info.ssl_cert_filepath                 = pWebServer->m_ssl_certificate_.c_str();
           info.ssl_private_key_filepath  = pWebServer->m_ssl_certificate_key_.c_str();
          // info.ssl_ca_filepath                 = pWebServer->m_ssl_ca_certificate_.c_str();
     }

     context = libwebsocket_create_context(&info);


In the client part :

        if (use_ssl)
        {
                info.ssl_cert_filepath                  = CERT_FILE;
                info.ssl_private_key_filepath   = KEY_FILE;
        }

        info.gid = -1;
        info.uid = -1;

        context = libwebsocket_create_context(&info);

        if (context == NULL)
        {
                lwsl_err("libwebsocket init failed\n");
                return -1;
        }

        printf("Client connecting to %s:%u....\n", IP, PORT);

        lwsl_notice("Client connecting to %s:%u....\n", IP, PORT);

        wsi = libwebsocket_client_connect(context, IP, PORT, 2, "/", IP, "origin", NULL, -1);

########################################################

Thanks a lot!


Este mensaje se dirige exclusivamente a su destinatario y puede contener información privilegiada o CONFIDENCIAL. Si no es vd. el destinatario indicado, queda notificado de que la utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción.

This message is intended exclusively for its addressee and may contain information that is CONFIDENTIAL and protected by professional privilege.
If you are not the intended recipient you are hereby notified that any dissemination, copy or disclosure of this communication is strictly prohibited by law. If this message has been received in error, please immediately notify us via e-mail and delete it.


More information about the Libwebsockets mailing list