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. Qt5 QWebView how to send client certificate?

Qt5 QWebView how to send client certificate?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.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.
  • L Offline
    L Offline
    lvshuchengyin
    wrote on last edited by
    #1

    I use Qt5's QWebView to load a https website, which need client certificate. I have installed client certificate and used chrome and ie browser to test ok. But it didn't work in the QWebView.

    @QNetworkRequest request;
    request.setUrl(QUrl("https://mysite.com/default2.aspx"));

    QSslConfiguration conf = request.sslConfiguration();
    //get the client certificate
    QByteArray certData = getCertInWindowsMyStore();
    QSslCertificate sslCert(certData, QSsl::Der);
    conf.setLocalCertificate(sslCert);

    request.setSslConfiguration(conf);

    ui->webView->load(request);@

    I print the certicate's subjectinfo which is correctly.
    I seach some infomation from google. Someone says I have to set the private key, someone didn't set also can work fine. How it works?
    And I think that I used chrome browser to visit that website, it work fine, but chrome wouldn't know the private key, so I think the private key no need to set.

    Does anyone know how to do? This question has tortured me very much!

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      check the following if the certificate is more or less valid after you have created it.

      From the QSslCertificate docs:
      [quote]
      After loading a certificate, you can find information about the certificate, its subject, and its issuer, by calling one of the many accessor functions, including version(), serialNumber(), issuerInfo() and subjectInfo(). You can call effectiveDate() and expiryDate() to check when the certificate starts being effective and when it expires. The publicKey() function returns the certificate subject's public key as a QSslKey. You can call issuerInfo() or subjectInfo() to get detailed information about the certificate issuer and its subject.[/quote]

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lvshuchengyin
        wrote on last edited by
        #3

        Thanks again!
        I have check that but still no clue. :(
        Could you know some example?
        Does it need set private key?

        [quote author="raven-worx" date="1388672307"]check the following if the certificate is more or less valid after you have created it.

        From the QSslCertificate docs:
        [quote]
        After loading a certificate, you can find information about the certificate, its subject, and its issuer, by calling one of the many accessor functions, including version(), serialNumber(), issuerInfo() and subjectInfo(). You can call effectiveDate() and expiryDate() to check when the certificate starts being effective and when it expires. The publicKey() function returns the certificate subject's public key as a QSslKey. You can call issuerInfo() or subjectInfo() to get detailed information about the certificate issuer and its subject.[/quote][/quote]

        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