IOS IPA Re-packagin / Re-Signing AppStore

Description of the problem

I need to manage an arbitrary application on an iOS device, my plan is to enter the executable file in IPA (where the remote control logic is implemented), and then repack it.

Since the application should work in a controlled environment (specific device), I plan to use my provisioning profile with my development certificate for re-packaging / signing.

To begin with, I'm trying to re-package a third-party application without entering code, this is done as follows:

1. Unzip the existing IPA 2. Copy the provisioning profile to %APP_NAME%.app/embedded.mobileprovisioning 3. export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate" 4. signcode --force --deep -s "%Dev Cert Name%" "%Path/To/APP_NAME%.app" 5. zip the re-signed code back together 

The Above works great for applications that I manually create using Xcode, however when using IPAs downloaded from the AppStore, this does not work with the following device log error:

 <Debug>: AppleFairplayTextCrypterSession::fairplayOpen() failed, error -42112 

Checking the "Mach-O" Executable application, I checked that the "Signing Codes" section of the corresponding architecture is completely changed (using the "signcode" tool).

Questions

  • Why can't I re-pack the application that I downloaded from the AppStore while the application that I manually create w / Xcode has successfully re-packaged / signed?
  • How can I re-pack / sign the AppStore application with my development certificate and provisioning profile?
  • How does FairPaly distinguish an application that I manually create (using Xcode) for an application downloaded from the AppStore? What about the remnants of the appstore application that the application does not do manually?

References

+5
source share
1 answer

Applications from the AppStore are not just signed, and the binary is also encrypted .

App Store binaries are signed by both their developer and Apple. This encrypts the binary, so decryption keys are needed in order to do binary reading. When iOS executes binary code, decryption keys are used to decrypt the binary file into a readable state, where it is then loaded into memory and executed. iOS can report the encryption status of the binary using the cryptid struture element of the LC_ENCRYPTION_INFO MachO command. If cryptid is a nonzero value, then the binary is encrypted.

+5
source

Source: https://habr.com/ru/post/1202158/


All Articles