+

Search Tips | Advanced Search

For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Enabling OpenSSL for iOS

The MobileFirst iOS SDK uses native iOS APIs for cryptography. We can configure the IBM MobileFirstâ„¢ Platform Foundation V8.0.0 to use the OpenSSL cryptography library in iOS apps.

Encryption/decryption is provided with the following APIs: WLSecurityUtils.encryptText() and WLSecurityUtils.decryptWithKey()


Option 1: Native encryption and decryption

Native encryption and decryption is provided by default, without using OpenSSL. This is equivalent to explicitly setting the encryption or decryption behavior as follows:

WLSecurityUtils enableOSNativeEncryption:YES


Option 2: Enabling OpenSSL

OpenSSL is disable by default. To enable it, proceed as follows:

  1. Install the OpenSSL frameworks:

    • With CocoaPods: Install the IBMMobileFirstPlatformFoundationOpenSSLUtils pod with CocoaPods. See Add OpenSSL with CocoaPods.
    • Manually in Xcode: Link the IBMMobileFirstPlatformFoundationOpenSSLUtils and openssl frameworks manually in the Link Binary With Libraries section of the Build Phases tab. See Add OpenSSL frameworks manually.

  2. The following code enables the OpenSSL option for the encryption/decryption:

    WLSecurityUtils enableOSNativeEncryption:NO The code will now use the OpenSSL implementation if found and otherwise throw an error if the frameworks are not installed correctly.

With this setup, the encryption/decryption calls use OpenSSL as in previous versions of the product.


Migration options

If you have an MobileFirst project that was written in an earlier version, you might need to incorporate changes to continue using OpenSSL.

Parent topic: Develop native applications for iOS in Xcode