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
Contributor
mariomunera89
Posts: 15
Registered: ‎10-10-2012
My Device: Blackberry 10 Dev Alpha
Accepted Solution

SSL Handshake Failed in BB10 QNX Momentics IDE

[ Edited ]

I'm trying to make a connection to a web service that uses SSL. I'm working with Blackberry 10 in C++ with the QNX IDE Momentics. The connection that I'm trying to do is as follows:

 

URL: "https://movilapi...."

 

Code: 

networkAccessManager = new QNetworkAccessManager(this);
    bool res = connect(networkAccessManager, SIGNAL(finished(QNetworkReply*)),
            this, SLOT(requestFinished(QNetworkReply*)));

    Q_ASSERT(res);
    Q_UNUSED(res);

    QNetworkRequest request = QNetworkRequest(QUrl(url));
    request.setRawHeader("User-Agent", "bb-phone/20120910");
    request.setRawHeader("Content-Type", "application/json");
    request.setRawHeader("Content-Length", postDataSize);

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

        networkAccessManager->post(request, outData);

 

I'm always getting the same error no matter wich service I try to reach. The response is: SSL handshake failed

Please help, I've been searching for hours without success. Thanks.

Contributor
mariomunera89
Posts: 15
Registered: ‎10-10-2012
My Device: Blackberry 10 Dev Alpha

Re: SSL Handshake Failed in BB10 QNX Momentics IDE

After getting in touch with a few RIM personal about this particular issue we found out that the TLS/SSL server is intolerant of certain extensions, so with the following Qt code to disable transmission of extensions the connection was succesfully made through https:

 

QSslConfiguration cfg(request.sslConfiguration());
cfg.setSslOption(QSsl::SslOptionDisableSessionTickets, true);
request.setSslConfiguration(cfg);

 

I want to make special mention of the Application Development department of Research In Motion for the attention and the effort invested on this issue until we finally got the right way to go.

 

Below is the entire connection code in case that anybody is facing this need:

 

networkAccessManager = new QNetworkAccessManager(this);
bool res = connect(networkAccessManager, SIGNAL(finished(QNetworkReply*)),
            this, SLOT(requestFinished(QNetworkReply*)));    
QNetworkRequest request = QNetworkRequest(QUrl(url));
request.setRawHeader("User-Agent", "BB_PHONE/20120926");
request.setRawHeader("Content-Type", "application/json");
request.setRawHeader("Content-Length", postDataSize);

QSslConfiguration sslConfig = request.sslConfiguration();
sslConfig.setPeerVerifyMode(QSslSocket::VerifyNone);
sslConfig.setPeerVerifyDepth(1);
sslConfig.setProtocol(QSsl::TlsV1);
sslConfig.setSslOption(QSsl::SslOptionDisableSessionTickets, true);

request.setSslConfiguration(sslConfig);
networkAccessManager->post(request, outData);