summaryrefslogtreecommitdiffstats
path: root/doc/src/platforms/android/android-openssl-support.qdoc
blob: 249c04f6f5fac93352a07531cff4edbdfefc1026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
\page android-openssl-support.html
\title Adding OpenSSL Support for Android
\brief Provides instructions to package OpenSSL libraries with your Qt application for Android.

The Qt installation package comes with OpenSSL support but the OpenSSL libraries
are not part of the package due to legal restrictions in some countries. If your
application depends on OpenSSL, consider packaging the SSL libraries with your
Application Package (APK) as the target device may or may not have them. You
can use the \l{QSslSocket::supportsSsl()} static function to check for SSL
support on the target.

The following instructions guide you to build and add the OpenSSL libraries to
the APK:
\list 1
 \li Download the latest OpenSSL 1.1.x sources from \l{http://www.openssl.org/source}.

 \li Extract the sources to a folder and navigate to that folder using
     the CLI.
     \note If your development platform is Windows, you need \c msys with
     \c perl v5.14 or later to build OpenSSL.

 \li Add android llvm toolchain to your path:
    \badcode
    export PATH="<android_ndk_path>/toolchains/llvm/prebuilt/<host>/bin":$PATH
    \endcode

 \li Configure the OpenSSL sources to build for Android using
     the following command:

     \badcode
     ./Configure shared android-<arch> -D__ANDROID_API__=21
     \endcode

     \note You must consider enabling/disabling the SSL features based on the
     legal restrictions in the region where your application is available.
     See the \l{OpenSSL Configure Options}{SSL configure options} for details about
     the configurable features.

 \li Run \c{make SHLIB_VERSION_NUMBER= SHLIB_EXT=_1_1.so build_libs} to
     build \c libcrypto and \c libssl shared libraries that are not versioned,
     but with a \e _1_1 suffix. If you want to use a different suffix, then you must
     set the \c ANDROID_OPENSSL_SUFFIX environment variable before you access the
     Qt Network API. Without a suffix, Android 5 (API 21) will load the system
     libraries \e libcrypto.so and \e libssl.so, which are OpenSSL 1.0, rather than
     your libraries.

     \note Android does not load versioned libraries.

 \li Open your Qt project using Qt Creator and update the "Build Android APK"
     settings to add \e libcrypto and \e libssl as additional libraries for
     your project.

 \li Run your application to see it running on the device.
\endlist

\note here \l{https://github.com/KDAB/android_openssl} you can find a script which
can be used to compile openssl for all android abis and also latest prebuilt libs.

Qt Creator builds your application and creates an application package (APK)
with the OpenSSL libraries bundled in it. Once the APK is ready, it uses \c adb
to deploy the APK on the target you chose and launch the application.

*/