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

SslHandshakeFailedError is encountered in VerifyPeer mode by Self-signed certificate

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.15.2
    • Network: SSL
    • None
    • ubuntu16.04
      openssl1.1.1f
    • Linux/X11

    Description

      I loaded the server certificate and set verifyPeer to verify the server certificate, but encountered SslHandshakeFailedError, the same of certificate is correctly called through the X509_STORE_add_cert function

       

      // code placeholder
          QNetworkAccessManager access;
          QSslConfiguration sslConfig;
          QList<QSslCertificate> listCa;   
          QNetworkRequest request;
          QFile pem("/home/wn/cert.pem");
          QFile pem1("/home/wn/cert1.pem");
          pem.open(QIODevice::ReadOnly);
          pem1.open(QIODevice::ReadOnly);
          QByteArray arr = pem.readAll();
          QByteArray arr1 = pem1.readAll();   
          QSslCertificate cert(arr, QSsl::Pem);
          QSslCertificate cert1(arr1, QSsl::Pem);    
          listCa << cert << cert1;    
          sslConfig = QSslConfiguration::defaultConfiguration();
          sslConfig.setCaCertificates(listCa);
          sslConfig.setProtocol(QSsl::TlsV1_0OrLater);
          sslConfig.setPeerVerifyMode(QSslSocket::VerifyPeer);
          sslConfig.setPeerVerifyDepth(1);    
          request.setSslConfiguration(sslConfig);
          request.setUrl(QUrl(QString("https://192.168.20.211:6094/CasCenterApi/v3.0/authSiginbyCa")));
          QByteArray body;            
          access.post(request, body);
      

      Attachments

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

        Activity

          People

            tpochep Timur Pocheptsov
            muse117 wn wn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes