Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 45
Registered: ‎07-19-2013
My Device: BlackBerry Q5, Playbook, 9790,9800
My Carrier: TELUS
Accepted Solution

Error: SSL handshake fail

Error: SSL handshake failed, what is wrong

 

here is code:

 

const QUrl url("http://xxxxxx.com");

QNetworkRequest request(url);

if (AppSettings::isUsingHttps()) {
request.setUrl(QUrl("https://xxxxxxxx.com"));

QSslConfiguration config = request.sslConfiguration();
config.setPeerVerifyMode(QSslSocket::VerifyNone);
//config.setProtocol(QSsl::TlsV1);
request.setSslConfiguration(config);
}

QNetworkReply* reply = m_networkAccessManager->get(request);
bool ok = connect(reply, SIGNAL(finished()), this, SLOT(onGetReply()));
Q_ASSERT(ok);
Q_UNUSED(ok);

Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: Error: SSL handshake fail

Make it easy

 

QNetworkReply *reply = m_networkAccessManager->get(request);
reply->ignoreSslErrors();

 



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Error: SSL handshake fail


Benecore wrote:

Make it easy

 

QNetworkReply *reply = m_networkAccessManager->get(request);
reply->ignoreSslErrors();

 


I would not suggest to follow this "advice", with code like this there is no reason to use https at all.

You can call ignoreSslErrors with a QList of QSslError objects.

Unfortunately you cannot use the systems certificate store (which is really stupid), so you have to handle importing of the server certificate (chain) yourself.

If you have the cert you create the list of QSslErrors with the certificate, then pass that to the ignore method.

 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter