Menu
Menu
inquire

Documentation

iOS

DexProtecting iOS Frameworks and XCFrameworks

Frameworks

This section offers guidance on protecting Frameworks and XCFrameworks independently. It is therefore intended primarily for developers who ship SDKs. If you are interested in protecting Frameworks already integrated in an application package, please see the general guidance on configuring DexProtector.

DexProtector applies the same protection mechanisms for Frameworks as for IPAs, and configuration is the same, but there is a crucial difference in the protection process:

  1. DexProtector accepts as an input a folder (via DexProtector Studio: a .zip archive) containing one or several .framework files.

  2. DexProtector will protect all Framework(s) within that folder, and output a folder (or, via DexProtector Studio, a .zip archive) containing the protected Framework(s) and a uniquely generated companion Framework containing the DexProtector runtime engines necessary to support the specific protected Framework(s).

  3. The protected and companion Frameworks within this bundle are interdependent, and must be implemented together, otherwise they will be inoperable.

To protect a Framework via DexProtector Studio, therefore, the steps are as follows:

  1. Compress the Framework you wish to protect into a .zip archive

  2. Load the .zip archive along with your reference configuration in DexProtector Studio

  3. Adjust your configuration as required

  4. Run protection

  5. DexProtector Studio will output a .zip archive containing the protected Framework and the companion Framework containing the runtime engines that manage decryption and RASP

  6. Implement the protected Framework and the DexProtector companion Framework in your application project

XCFrameworks

This section offers guidance on protecting Frameworks and XCFrameworks independently. It is therefore intended primarily for developers who ship SDKs. If you are interested in protecting Frameworks already integrated in an application package, please see the general guidance on configuring DexProtector.

Here are the details on how to process .xcframework archives for protection:

DexProtecting .xcframeworks

DexProtector accepts as an input a folder containing one or several .xcframework archives. For example, to protect the contents of a single .xcframework, create a folder such as the following:

MyProject

├── MyFramework.xcframework
│ ├── Info.plist
│ ├── ios-arm64
│ │ ├── MyFramework.framework
│ │ │ ├── Headers
│ │ │ ├── Modules
│ │ │ ├── Resources
│ │ │ └── MyFramework (binary file for ARM64)
│ │ └── Info.plist
│ ├── ios-arm64_x86_64-simulator
│ │ ├── MyFramework.framework
│ │ │ ├── Headers
│ │ │ ├── Modules
│ │ │ ├── Resources
│ │ │ ├── MyFramework (binary file for ARM64 and x86_64 simulators)
│ │ │ └── Info.plist
│ └── ...
└──

Executing protection on this .xcframework will then look like this:

java -cp dexprotector.jar com.licel.dexprotector.ios.ConsoleTask -configFile dexprotector.xml MyProject ProtectedMyProject

DexProtector will process all Frameworks within that folder, protect all ARM64 binaries, and skip all other binaries. It will also generate a unique Companion .xcframework containing the DexProtector runtime engines (for decryption and RASP) necessary to support the specific protected Framework(s). You can also optionally specify the name of the Companion Framework in your DexProtector configuration, for example:

<ios companionFrameworkName="ProtectionModule" ....> </ios>

In which case the output ProtectedMyProject folder will look like this:

ProtectedMyProject

├── MyFramework.xcframework
│ ├── Info.plist
│ ├── ios-arm64
│ │ ├── MyFramework.framework
│ │ │ ├── Headers
│ │ │ ├── Modules
│ │ │ ├── Resources
│ │ │ └── MyFramework (protected binary file for ARM64)
│ │ └── Info.plist
│ ├── ios-arm64_x86_64-simulator
│ │ ├── MyFramework.framework
│ │ │ ├── Headers
│ │ │ ├── Modules
│ │ │ ├── Resources
│ │ │ ├── MyFramework (binary file for ARM64 and x86_64 simulators; only ARM64 binaries are protected)
│ │ │ └── Info.plist
│ └── ...
├── ProtectionModule.xcframework
│ ├── Info.plist
│ ├── ios-arm64
│ │ ├── ProtectionModule.framework
│ │ │ ├── Info.plist
│ │ │ └── ProtectionModule (companion binary file for ARM64)
│ ├── ios-arm64-simulator
│ │ ├── ProtectionModule.framework
│ │ │ ├── Info.plist
│ │ │ └── ProtectionModule (companion binary file for ARM64 simulator)

Each protected Framework must always be implemented in an app project together with the corresponding Companion Framework, otherwise they will be inoperable.

Note 1: DexProtector supports protection of ARM64 binaries only, for both hardware devices and simulators. Binaries targeted to other architectures will be skipped.

Note 2: DexProtector currently supports protection of .xcframework archives only via the command line, and not via DexProtector Studio.