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. Secure connection to the websocket server
Forum Updated to NodeBB v4.3 + New Features

Secure connection to the websocket server

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 957 Views 2 Watching
  • 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.
  • F Offline
    F Offline
    Flysink
    wrote on last edited by
    #1

    I have a problem with connection through protocol scheme wss, my certificate comodo positivessl
    Standard js query:

    let socket = new WebSocket("wss://server:port");
    

    error: failed: Error in connection establishment: net::ERR_CERT_COMMON_NAME_INVALID

    I also tried:

    QList<QSslCertificate> ca = sslConfiguration.caCertificates();
     ca.append(QSslCertificate(byte,QSsl::Pem));
     sslConfiguration.setCaCertificates(ca);
    

    error: in connection establishment: net::ERR_CONNECTION_CLOSED

    when i am trying to connect ,on the server there are no errors and signals about connection
    and

    qDebug() << sslConfiguration.peerCertificate();
    

    here's what happens

    QSslCertificate("", "", "922M4Y88sgT3gBhY721Cfc==", (), (), QMap(), QDateTime(Invalid), QDateTime(Invalid))
    
    QSslConfiguration sslConfiguration;
     QFile certFile(QStringLiteral(":/ct/local.crt"));
     QFile keyFile(QStringLiteral(":/ct/local.key"));
     certFile.open(QIODevice::ReadOnly);
     keyFile.open(QIODevice::ReadOnly);
     QSslCertificate certificate(&certFile, QSsl::Pem);
     QSslKey sslKey(&keyFile, QSsl::Rsa, QSsl::Pem);
     sslConfiguration.setPeerVerifyMode(QSslSocket::VerifyNone);
     sslConfiguration.setLocalCertificate(certificate);
     sslConfiguration.setPrivateKey(sslKey);
     sslConfiguration.setProtocol(QSsl::TlsV1SslV3);
     wtServer->setSslConfiguration(sslConfiguration);
    
    objConnect.append(QObject::connect(wtServer, &QWebSocketServer::newConnection, this, &Server::newUser));
    objConnect.append(QObject::connect(wtServer, &QWebSocketServer::sslErrors, this, &Server::onSslError));
    objConnect.append(QObject::connect(wtServer, &QWebSocketServer::closed, this, &Server::close));
    

    What is the possible cause?

    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