I am developing my custom browser in Qt using QWebView and I am trying to make my own root cert store of trusted certificates which are taken from mozilla project.
I have used QSslSocket::setDefaultCaCertificates() to override the default certificates. But I am not able to load https://www.gmail.com , where as in mozilla it works.
I have set all required root certs for gmail to my store.
can anyone guide me ?
The reason you can't connect is because the SSL certificate (with serial
2F:DF:BC:F6:AE:91:52:6D:0F:9A:A3:DF:40:34:3E:9A
) presented to you when you connect to www.gmail.com is issued for a different domain - www.google.com. This has nothing to do with root CA certificate store because no root CA certificate is needed to compare cert's Subject CN field with the host you are trying to connect to. You can ignore this and other SSL errors by callingvoid QNetworkReply::ignoreSslErrors () [virtual slot]
To avoid this error you can connect directly to https://mail.google.com which is the domain you are being redirected to when you try to connect to https://www.gmail.com
Below is a working example which will show you the exact SSL errors and QNAM level errors. Either line B1 or line B2 must be active at the same time. You can comment line A if you want to see what happens with the default (system) root CA certificate store. There are two certs used by this code; CA's cert with serial
30:00:00:02
should be placed in a file calledThawteSGCCA.crt
and CA's cert with serial70:BA:E4:1D:10:D9:29:34:B6:38:CA:7B:03:CC:BA:BF
should be placed in a file calledBuiltinObjectToken-VerisignClass3PublicPrimaryCertificationAuthority.crt
.