The MobileFirst iOS
SDK uses native iOS APIs for cryptography. You can configure the MobileFirst V8.0.0 to
use the OpenSSL cryptography library in your Cordova iOS app.
The encryption/decryption functionalities are provided with
the following Javascript APIs:
WL.SecurityUtils.encryptText
WL.SecurityUtils.decryptWithKey
Option 1: Native encryption/decryption
By
default
MobileFirst provides
native encryption/decryption, without using OpenSSL. This is equivalent
to explicitly setting the encryption/decryption behavior:
WL.SecurityUtils.enableNativeEncryption(true)
Option 2: Enabling OpenSSL
MobileFirst provided
OpenSSL is disabled by default.
To
install the necessary frameworks for supporting OpenSSL, first install
the Cordova plug-in:
cordova
plugin add cordova-plugin-mfp-encrypt-utils
The following
code enables the OpenSSL option for the encryption/decryption:
WL.SecurityUtils.enableNativeEncryption(false)
With
this setup, the encryption/decryption calls use OpenSSL as in previous
versions of MobileFirst.
Migration options
If
you have an IBM MobileFirst™ Platform Foundation project
written in an earlier version, you may need to incorporate changes
to continue using OpenSSL.
- If the application is not using encryption/decryption APIs, and
no encrypted data is cached on the device, no action is needed.
- If the application is using encryption/decryption APIs you have
the option of using these APIs with or without OpenSSL.
- Migrating to native encryption:
- Make sure the default native encryption/decryption option is chosen
(see Option 1).
- Migrating
cached data: If the previous installation of IBM MobileFirst Platform Foundation saved
encrypted data to the device using OpenSSL, but the native encryption/decryption
option is now chosen, the stored data must be decrypted. The first
time the application attempts to decrypt the data it will fall back
to OpenSSL and then encrypt it using native encryption. This way the
data will be auto-migrated to native encryption.
Note: To allow the decryption from OpenSSL, you
must add the OpenSSL frameworks by installing the Cordova plug-in:
cordova
plugin add cordova-plugin-mfp-encrypt-utils
- Continuing with OpenSSL: If OpenSSL is required use the
setup described in Option 2.