Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-119609

QAbstractHttpServer not supporting certificate chains

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.6.0
    • Qt Http Server
    • None
    • All

    Description

      Hi!

      I am using QHttpServer for a Viber bot and yesterday stopped working because they changed something and from now on if you have a Let's Encrypt certificate for free than you have a chain in it and that is not working together with the new Viber setup. The current implementation in the QHttpServer the 

       void sslSetup(const QSslCertificate &certificate, ... ); 

      function only supports one certificate to send to the Viber framework which leads to a TLS error "Alert (Level: Fatal, Description: Certificate unknown)" and the socket is closed. This happend only when you tried to send a message from a Phone/PC client to the bot. When the bot communicated with the Viber framework it worked fine.

      I am proposing this simple fix to solve this problem:
      Add to class QAbstractHttpServer in qabstracthttpserver.h : 48. :

      #if QT_CONFIG(ssl)
          void sslSetup(const QSslCertificate &certificate, const QSslKey &privateKey,
                        QSsl::SslProtocol protocol = QSsl::SecureProtocols);
          void sslSetup(const QList<QSslCertificate> &certificates, const QSslKey &privateKey,
                        QSsl::SslProtocol protocol = QSsl::SecureProtocols);
          void sslSetup(const QSslConfiguration &sslConfiguration);
      #endif
      

      add to the qabstracthttpserver.cpp : 260

      void QAbstractHttpServer::sslSetup(const QList<QSslCertificate> &certificates,
                                         const QSslKey &privateKey, QSsl::SslProtocol protocol)
      {
          QSslConfiguration conf;
          conf.setLocalCertificateChain(certificates);
          conf.setPrivateKey(privateKey);
          conf.setProtocol(protocol);
          sslSetup(conf);
      }
      

      With this small change the Viber bot started to work again.

      Thank you!

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mikhailsvetkin Mikhail Svetkin
            sbela Sebestyén Béla
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes