Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. self signed Certificate error
Qt 6.11 is out! See what's new in the release blog

self signed Certificate error

Scheduled Pinned Locked Moved Mobile and Embedded
qt5.4qt5.4.1androidandroidqt
5 Posts 2 Posters 5.3k Views 1 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.
  • BuleronB Offline
    BuleronB Offline
    Buleron
    wrote on last edited by Buleron
    #1

    How to install or load a crt or pfx Certificate in Qt for webService https untrusted , using soap library request

    i use this code deploying in android , but still appear
    error: Network transport error (6): SSL handshake failed"

    QFile certFile(":/cert.crt");
    Q_ASSERT(certFile.open(QIODevice::ReadOnly));
    QSslCertificate cert(&certFile, QSsl::Pem);
    QSslSocket *sslSocket = new QSslSocket(this);
    sslSocket->addCaCertificate(cert);
    

    ??

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by mcosta
      #2

      Hi and welcome to devnet,

      here you can see how to disable this error (by default Qt don't allows self-signed certificate)

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • BuleronB Offline
        BuleronB Offline
        Buleron
        wrote on last edited by
        #3

        @mcosta thanks for reply
        i use that one but im still have the same problem
        QList<QSslCertificate> cert = QSslCertificate::fromPath(QLatin1String(":/certificate.crt"));
        QSslError error(QSslError::SelfSignedCertificate, cert.at(0));
        QList<QSslError> expectedSslErrors;
        expectedSslErrors.append(error);

         QSslSocket socket;
         socket.ignoreSslErrors(expectedSslErrors);
         socket.connectToHostEncrypted("https://host",port);
        
        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          Hi,

          can you print the list of SSL errors? qDebug() << socket.sslErrors()

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • BuleronB Offline
            BuleronB Offline
            Buleron
            wrote on last edited by Buleron
            #5

            @mcosta
            W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
            W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
            W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
            W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
            W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
            W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
            W/libPmps.so(10267): (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated

            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