- Qt 5.3
- Adding OpenSSL Support
- Qt 5.3.2 Reference Documentation

# Adding OpenSSL Support

The Qt installation package does not ship the OpenSSL libraries due to legal restrictions in some countries. If you want to use OpenSSL in your application, you must build the OpenSSL libraries for Android and bundle them with your Application Package (APK) to ensure that your application behaves as expected on the device.

Note: If your development platform is Windows, you need `msys` with `perl` v5.14 or later to build OpenSSL.

The following instructions guide you to add OpenSSL support to your application:

1. Download the latest OpenSSL sources from http://www.openssl.org/source.
2. Extract the sources to a folder and navigate to that folder using the CLI (`msys` shell on Windows).
3. Set the following environment variables to point to the ARM compiler toolchain and sysroot you want to use:

       CC=<ANDROID_NDK_PATH>/toolchains/arm-linux-androideabi-<VER>/prebuilt/<NDK_HOST>/bin/arm-linux-androideabi-gcc
       AR=<ANDROID_NDK_PATH>/toolchains/arm-linux-androideabi-<VER>/prebuilt/<NDK_HOST>/bin/arm-linux-androideabi-ar
       ANDROID_DEV=<ANDROID_NDK_PATH>/platforms/android-9/arch-arm/usr

4. Configure the OpenSSL sources to build for Android (ARMv5 or ARMv7) using the following command:

       ./Configure shared android or android-armv7

   Note: You can also configure it for mips or x86 architectures.

5. Run `make build_libs` to build the `libcrypto` and `libssl` shared libraries.
6. Open your Qt project using Qt Creator and update the "Deployment Configuration" under run settings to add libcrypto and libssl as additional libraries required for your project.
7. Run your application to see it running on the device.

Qt Creator builds your application and creates an application package (APK) with the OpenSSL libraries bundled in it. Once the APK is ready, Qt Creator prompts you to choose the device to install the APK, and then you should see your application running on the device you selected.