[Interest] How to trust certificates for QWebPage

Richard Moore rich at kde.org
Mon May 26 15:10:30 CEST 2014


What you need to do is create your own CA certificate, then generate a leaf
certificate that is signed by it for your server. You then get the
QNetworkAccessManager that you're using to load the content for your
QWebPage and get its QSslConfiguration. Finally use setCaCertificate on the
configuration to tell it to trust certificates signed by your custom CA.

Cheers

Rich.


On 26 May 2014 11:30, Tom Isaacson <Tom.Isaacson at navico.com> wrote:

> We're implementing an application on an embedded Linux device that
> includes a browser using QWebPage in Qt 4.8.2. We also have OpenSSL
> installed but when I try to use https it fails with the error "SSL
> handshake failed". I can avoid this by calling ignoreSslErrors() in
> QWebPage::sslErrorHandler() but this isn't a solution.
>
> The way I think this should work is that when the device receives the
> certificate it should check it with the certificate authority. Is there
> some code I need to add to do this? Alternatively, because this is a custom
> embedded Linux device I'm wondering if I need to add some kind of
> certificate, since it doesn't have anything right now. I can see from the
> code at the bottom of this article that it's possible to add certificates
> but I don't know what kind of certificate or where to get it from:
>
> http://www.qtforum.org/article/37666/qwebview-not-displaying-some-ssl-pages-on-windows-qt-4-8-mingw.html
>
> Any suggestions would be a great help, thanks.
>
> Tom Isaacson
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140526/183a1907/attachment.html>


More information about the Interest mailing list