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
idom
Posts: 16
Registered: ‎06-17-2012
My Device: BlackBerry Playbook
Accepted Solution

Problem with HTTPS on Simulator

Hello. 

I attempt to run my application on simulator and have some problem. 

My app works with Dropbox service. In attempt of the appeal to service according to the HTTPS protocol, application reports about failure in the course of the SSL dialog. I tried to appeal to a service site via the browser (also on HTTPS). The browser suggested to accept the certificate. After certificate acceptance the browser again tries to address to a site, but is closed in some seconds.

 

How fix this problem? Whether there is such problem on the BlackBerry Playbook device?

Please use plain text.
BlackBerry Development Advisor (Retired)
selom
Posts: 60
Registered: ‎05-10-2012
My Device: Blackberry 10 Alpha

Re: Problem with HTTPS on Simulator

Hello idiom,

 

can you provide a bit of code as to how you are making this https call from your dropbox app?

 

Selom

Please use plain text.
Contributor
idom
Posts: 16
Registered: ‎06-17-2012
My Device: BlackBerry Playbook

Re: Problem with HTTPS on Simulator

QNetworkRequest networkRequest(url);
oAuth->signRequestHeader("GET", &networkRequest, &userData);
networkAccessManager->get(*networkRequest);

 Where signRequestHeader() is:

void OAuth::signRequestHeader(
    QString method,
    QNetworkRequest *networkRequest,
    UserData *userData
    )
{
    QString header = "OAuth ";

    header += timestampAndNonceHeaderItems() + ",";
    header += consumerKeyHeaderItem() + ",";
    header += signatureMethodHeaderItem() + ",";
    if(userData != 0)
    {
        header += userTokenHeaderItem(userData) + ",";
    }
    header += versionHeaderItem() + ",";

    QUrl url = networkRequest->url();
    header += signatureHeaderItem(
        userData,
        method,
        &url,
        header
        ) + ",";

    //remove the last ","
    header.chop(1);

    networkRequest->setRawHeader("Authorization", header.toAscii());
}

 

The message of "SSL handshake failed" appeared in case of compilation for Linux on which there were no OpenSSL libraries. Probably in a simulator there are no SSL libraries?

Please use plain text.
Contributor
idom
Posts: 16
Registered: ‎06-17-2012
My Device: BlackBerry Playbook

Re: Problem with HTTPS on Simulator

[ Edited ]

Maybe problem in using class QNetworkAccessManager ?

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Problem with HTTPS on Simulator

The message of "SSL handshake failed" appeared in case of compilation for Linux on which there were no OpenSSL libraries. Probably in a simulator there are no SSL libraries?

 can you elaborate on that please? Lunix on which there were no OpenSSL libraries?

Please use plain text.
Contributor
idom
Posts: 16
Registered: ‎06-17-2012
My Device: BlackBerry Playbook

Re: Problem with HTTPS on Simulator

I mean a distribution kit without the packets of openssl and libssl-dev included by default. I not very well know Linux, probably incorrectly described this case.

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Problem with HTTPS on Simulator

NDK and Simulator should have all needed libraries.

Please use plain text.
BlackBerry Development Advisor (Retired)
selom
Posts: 60
Registered: ‎05-10-2012
My Device: Blackberry 10 Alpha

Re: Problem with HTTPS on Simulator

Hello idiom,

 

to use https you need to set the SSL configuration on your request before sending it. For example..

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

 

Cheers

Selom

Please use plain text.
Contributor
idom
Posts: 16
Registered: ‎06-17-2012
My Device: BlackBerry Playbook

Re: Problem with HTTPS on Simulator

Tried your decision, application was finished, again, without notice about a ssl dialog error.

Please use plain text.
BlackBerry Development Advisor (Retired)
selom
Posts: 60
Registered: ‎05-10-2012
My Device: Blackberry 10 Alpha

Re: Problem with HTTPS on Simulator

I'm sorry your response was not clear to me. Did you receive SSL errors in your logs or did the call fail for other reasons? Are you able to get the response code? It might suggest a problem with your oauth signature or headers

 

Selom

Please use plain text.