iOS IPA 重新打包/重新签名 App Store 应用程序

标签 ios xcode cocoa-touch fairplay

问题描述

我需要在 iOS 设备上控制任意应用程序,我的计划是将可执行文件注入(inject) IPA(实现远程控制逻辑的地方),然后重新打包。

由于应用程序应在受控环境(特定设备)中运行,我计划使用我的配置文件和我的开发证书进行重新打包/签名。

首先,我尝试在不注入(inject)任何代码的情况下重新打包第 3 方应用程序,这是通过以下方式完成的:

 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

上面的内容非常适合我使用 Xcode 手动构建的应用程序,但是,当使用从 AppStore 下载的 IPA 时,这不适用于以下设备日志错误:

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

检查应用程序的“Mach-O”可执行文件,我已验证相关架构的“代码签名”部分已完全更改(通过“signcode”工具)。

问题

  • 为什么我无法重新打包从 AppStore 下载的应用程序,而我使用 Xcode 手动创建的应用程序已成功重新打包/签名?
  • 如何使用我的开发证书和配置文件重新打包/签署 AppStore 应用程序?
  • FairPaly 如何区分我手动制作(使用 Xcode)的应用程序和从应用商店下载的应用程序?应用商店应用有哪些手动制作的应用没有的残差?

引用资料

最佳答案

来自 AppStore 的应用程序不仅经过签名,binary is also encrypted .

App Store binaries are signed by both their developer and Apple. This encrypts the binary so that decryption keys are needed in order to make the binary readable. When iOS executes the binary, the decryption keys are used to decrypt the binary into a readable state where it is then loaded into memory and executed. iOS can tell the encryption status of a binary via the cryptid struture member of LC_ENCRYPTION_INFO MachO load command. If cryptid is a non-zero value then the binary in encrypted.

关于iOS IPA 重新打包/重新签名 App Store 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25746191/

相关文章:

c++ - 将自定义对象作为参数从 Objective-C 传递给 C++

ios - Apple Developer - 配置文件显示无效状态

iphone - 根据首选项显示/隐藏 iphone UI 元素 - 如何?

ios - 这有可能强制 iOS 键盘弹出英文键盘吗?

iphone - 是否 applicationDidFinishLaunching : get called when application is updated and launched first time?

ios - 在 AIR for iOS 上启用 iCloud

ios - NSWindowController showWindow 是否触发嵌入式 NSView setNeedsDisplay?

ios - 按下按钮(操作)3 秒后清除 urtext 字段中的数据

ios - 我的xcode项目是否在复制自己?

iphone - NSArray enumerateObjectsUsingBlock : delay enumeration