Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [OSX] QSslSocket server with selfsigned cert
Forum Updated to NodeBB v4.3 + New Features

[OSX] QSslSocket server with selfsigned cert

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 457 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    luca
    wrote on last edited by
    #1

    Hi all,
    I have problem trying to setup QTcpServer with SSL selfsigned certificate.
    I'm working with Qt 5.6.2 .
    The code for the server is quite simple:

    1. QTcpServer subclass
    2. on the incomingConnection I have the following code:
        QSslConfiguration sslConfiguration;
        QSslCertificate certificate(server_cert_pem_ba, QSsl::Pem);
        QSslKey ssl_key(server_pkey_pem_ba, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, key_pwd.toLocal8Bit());
        sslConfiguration.setPeerVerifyMode(QSslSocket::VerifyNone);
        sslConfiguration.setLocalCertificate(certificate);
        sslConfiguration.setPrivateKey(ssl_key);
        sslConfiguration.setProtocol(QSsl::TlsV1SslV3);
    
        QSslSocket *socket = new QSslSocket(this);
        socket->setSslConfiguration(sslCconfiguration);
        socket->setSocketDescriptor(handle);
        connect(socket, SIGNAL(sslErrors(QList<QSslError>)) , this, SIGNAL(sslErrors(QList<QSslError>)));
        socket->startServerEncryption();
        socket->waitForEncrypted();
    

    To test the server I try to connect using a browser to check if it get the certificate:

    https://localhost:my_port
    

    The code works fine when I execute the server on linux.

    On OSX I get the incomingConnection but it never "encrypt".

    May it depend on the fact that I'm using a selfsigned certificate on OSX?
    Does OSX allow this?

    Thanks

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved