PDA

View Full Version : Use of QWebView to browse "https" secure sites



grigoryan_hayk
25th June 2008, 07:28
Hello,

I can't find how to browse secure sites (https) with use of QWebView. For example I load "www.yahoo.com" and then when I want to go to yahoo mail the site is not being load. I've used the browser application from QT examples and demos and find out that this browser also does not support entering secure sites. Please let me know if there is a way to solve this problem somehow.

Thanks,
Hayk

pvdk
25th June 2008, 20:58
From http://labs.trolltech.com/blogs/2008/03/05/webkit-demobrowser :

» Posted by Cepera
on Tuesday, March 25, 2008 @ 07:52
Looks like to turn on https OpenSSL should be installed on Windows.
And Qt should be configured with -openssl-linked option.

If images on web pages doesn’t work - it means imageformats not configured properly or plugins didn’t copied into target release directory.
Qt may be configured with build-in support of image formats: -qt-libpng -qt-libjpeg -qt-libtiff -qt-gif -qt-libmng

Hope that helps ;)

grigoryan_hayk
27th June 2008, 05:33
I don't have image loading errors. I just can't browse to secure sites (https) for example the mail.yahoo.com. As far as I understand this secure sites use SSL. When I remove all Certificates from my Firefox browser I see that when entering this type of sites they send me a certificate, and only after adding this certificate they let me to enter their sites.

pvdk
27th June 2008, 16:40
I don't have image loading errors. I just can't browse to secure sites (https) for example the mail.yahoo.com. As far as I understand this secure sites use SSL. When I remove all Certificates from my Firefox browser I see that when entering this type of sites they send me a certificate, and only after adding this certificate they let me to enter their sites.

I know, I just included that piece too for completeness sake. HTTPS does indeed work with SSL certificates. To get these working with QWebView you'll need to do the following:
(as mentioned in my other post)

- You need OpenSSL installed on your pc
- Then you need to recompile Qt with the -openssl-linked option

After this https links should work for you!
pvdk

grigoryan_hayk
30th June 2008, 06:23
Thanks,
I'll try to install OpenSSl library and then build QT source with the flag that you've told.

yop
30th June 2008, 17:46
- You need OpenSSL installed on your pc
- Then you need to recompile Qt with the -openssl-linked option


Do you have any experience on installing custom certificates under linux?
I can't seem to find a way to tell QtWebkit to trust a given site by accepting it's certificate.
https works for me but the above not. I think only signed by well known authorities certificates work. Maybe this has to be setup in the OS level and not QtWebkit?

nuald
30th April 2009, 05:05
Please review arora (http://code.google.com/p/arora/) sources. The main points are:

Set up a network access manager for the QWebPage instance via setNetworkAccessManager().
Override sslErrors() methods in the manager class.

After that you'll have two choices:

Ignore all SSL errors (via QNetworkReply::ignoreSslErrors()), but this is not secure.
Register a new SSL certificate for the required site (via QSslConfiguration::setCaCertificates() or related methods).

alexnum
21st September 2016, 21:16
Please review arora (http://code.google.com/p/arora/) sources. The main points are:

Set up a network access manager for the QWebPage instance via setNetworkAccessManager().
Override sslErrors() methods in the manager class.

After that you'll have two choices:

Ignore all SSL errors (via QNetworkReply::ignoreSslErrors()), but this is not secure.
Register a new SSL certificate for the required site (via QSslConfiguration::setCaCertificates() or related methods).


This might work smoothly in QWebPage. But in the the QWebEngine it is not possible to handle the ssl error like that. It is needed to:

Subclass QWebEnginePage and override the certificateError method, if you want to just ignore all errors, just make it return true OR if you want to deal with each error individally just check the QWebEngineCertificateError and return true/false depending of the error type
In your QWebEngineView don't load the page directly, do:

QWebEngineView* webView = new QWebEngineView(this);
CustomPage* page = new CustomPage(webView);
page->load(QUrl("https://www.self-signed-wild-page.com"));
webview->setPage(page);
webview->show();


And it's done =D