Tutorial: Use Secure Socket Layer

The Secure Socket Layer (SSL) security protocol is one of the most widely used security protocols on the Internet. SSL provides a secure means of exchanging sensitive data between two parties over one or more networks. In Cascades, the most powerful feature of SSL is how the use of 128-bit SSL encryption remains transparent to the user. This fact means that users don't have to do anything at all to protect their sensitive data. This simple user experience coupled with the strength of 128-bit encryption makes SSL a powerful tool for securing the transfer of sensitive data in all of your mobile apps.

This tutorial walks you through an app that connects to a remote server using SSL and port 443, which is the default port used for SSL communication. It also shows you how to send data, in this case text from a TextField control, to a remote server over the secure connection.

You will learn to:

  • Import an existing project into the Momentics IDE
  • Set up a secure connection that uses SSL and port 443
  • Initiate a secure connection and verify that it succeeded
  • Retrieve certificate information, which can be used for authentication, from a remote server
  • Send an HTTPS request over a network
  • Retrieve the network reply data
  • Communicate between C++ and QML
Screen shot of the SSL client sample app used in this discussion.

Before you begin

You should have the following things ready:

  • The BlackBerry 10 Native SDK
  • A device or simulator running BlackBerry 10

You can download the tools that you need and learn how to create, build, and run your Cascades project.

Downloading the full source code

This tutorial uses a step-by-step approach to walk you through an SSL sample app. If you want to follow along with the complete source code open in your Momentics IDE for BlackBerry, download the entire project and import it into the Momentics IDE. To learn how, see Import an existing project .

Download the full source code

Cutting and pasting the code shown in this tutorial does not produce a working project. We've removed parts of the code to help make it easier to read, follow, and explain. To see the complete source code for the sample app, download the project from the link provided above, and import it into your Momentics IDE editor.

A screen shot of the folders and files shown in the Project Explorer.

Take a moment to import the sample app project into your Momentics IDE.

Open the QML files found in the assets folder, as well as the C++ files found in the src folder.

Last modified: 2014-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus