如何重新签名ipa文件?

Joh*_*nny 104 ios ipa ios-provisioning

在使用不同的配置文件生成如下所示的IPA后,如何使用配置文件签署.ipa文件?我想在IPA上签署一个用于beta测试的临时配置文件,然后使用应用商店的应用提交配置文件重新签署确切的IPA.

/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"
Run Code Online (Sandbox Code Playgroud)

Bru*_*sky 191

从命令行执行起来非常简单.为了做到这一点,我有一个脚本的要点.它现在已经被整合到我每天使用的https://github.com/RichardBronosky/ota-tools中的ipa_sign脚本中.如果您对使用这些工具有任何疑问,请随时提出.

它的核心是:

IPA="/path/to/file.ipa"
PROVISION="/path/to/file.mobileprovision"
CERTIFICATE="Name of certificate: To sign with" # must be in keychain
# unzip the ipa
unzip -q "$IPA"
# remove the signature
rm -rf Payload/*.app/_CodeSignature
# replace the provision
cp "$PROVISION" Payload/*.app/embedded.mobileprovision
# sign with the new certificate (--resource-rules has been deprecated OS X Yosemite (10.10), it can safely be removed)
/usr/bin/codesign -f -s "$CERTIFICATE" Payload/*.app
# zip it back up
zip -qr resigned.ipa Payload
Run Code Online (Sandbox Code Playgroud)

您新签名的应用程序名为resigned.ipa

  • 7票而不是一个问题.我想我的bash就是那么清楚. (28认同)
  • 您可能会在--OSource Yosemite(10.10)中弃用--resource-rules参数时出现警告/错误,只需删除此参数即可解决此问题. (5认同)
  • 确实,先生,亲切的. (4认同)
  • 一个小注意:看起来`CodeResources`现在位于`_CodeSignature`文件夹的_inside_,所以你只需要删除该文件夹. (4认同)
  • @RahmathullahMPulikkal我看到我在精神上错误地编写了一条道路.你真的应该使用https://github.com/RichardBronosky/ota-tools/blob/master/ipa_sign而不是要点.这是维护的代码. (3认同)
  • 今天对我有用的:执行`security find-identity -v`来确定签名身份的ID.调用`/ usr/bin/codesign --force -s YOUR_IDENTITY -v Payload/*.app`来实际签署应用程序. (2认同)

Lor*_*rdT 36

检查iResign以获取有关如何执行此操作的简单工具!

[编辑]经过一番骚动后,我找到了一个解决钥匙串意识的问题.您可以访问https://gist.github.com/Weptun/5406993查看


Bry*_*anH 13

有点老问题,但使用最新的XCode,codesign很容易:

$ codesign -s my_certificate example.ipa 

$ codesign -vv example.ipa
example.ipa: valid on disk
example.ipa: satisfies its Designated Requirement
Run Code Online (Sandbox Code Playgroud)

  • @Pavel当iOS 6.x是最新版本时,这个问题得到了回答.从那以后,我们有两个主要版本,显然改变了很多东西.您可能希望将搜索范围限制为针对当前技术的答案. (2认同)
  • @BrunoBronosky 响应中也使用了 `codesign` 命令。我无法直接在“*.ipa”文件上使用它,并且“-vv”选项总是在我知道它们已签名的文件上返回`代码对象根本没有签名`... (2认同)

sim*_*yer 9

这里发布的答案对我来说都不太合适.他们主要跳过签署嵌入式框架(或包括权利).

这是什么对我有用(它假设存在一个ipa文件在当前目录中):

PROVISION="/path/to/file.mobileprovision"
CERTIFICATE="Name of certificate: To sign with" # must be in the keychain

unzip -q *.ipa
rm -rf Payload/*.app/_CodeSignature/

# Replace embedded provisioning profile
cp "$PROVISION" Payload/*.app/embedded.mobileprovision

# Extract entitlements from app
codesign -d --entitlements :entitlements.plist Payload/*.app/

# Re-sign embedded frameworks
codesign -f -s "$CERTIFICATE" --entitlements entitlements.plist Payload/*.app/Frameworks/*

# Re-sign the app (with entitlements)
codesign -f -s "$CERTIFICATE" --entitlements entitlements.plist Payload/*.app/

zip -qr resigned.ipa Payload

# Cleanup
rm entitlements.plist
rm -r Payload/
Run Code Online (Sandbox Code Playgroud)


mat*_*liu 7

Fastlane的叹息为辞职IPA提供了相当强大的解决方案.

从他们的自述文件:

辞职

如果您生成了ipa文件但想要将不同的代码签名应用到ipa文件,则可以使用sigh resign:

fastlane sigh resign

sigh 如果它们位于当前文件夹中,将为您找到ipa文件和配置文件.

您可以使用命令行传递更多信息:

fastlane sigh resign ./path/app.ipa --signing_identity "iPhone Distribution: Felix Krause" -p "my.mobileprovision"

它甚至可以处理嵌套应用程序的配置文件(例如,如果你有watchkit应用程序)


Pie*_*iot 7

我更新了Bryan的Sierra iMac代码:

# this version was tested OK vith macOs Sierra 10.12.5 (16F73) on oct 0th, 2017
# original ipa file must be store in current working directory 

IPA="ipa-filename.ipa"
PROVISION="path-to.mobileprovision"
CERTIFICATE="hexadecimal-certificate-identifier" # must be in keychain
# identifier maybe retrieved by running: security find-identity -v -p codesigning

# unzip the ipa
unzip -q "$IPA"

# remove the signature
rm -rf Payload/*.app/_CodeSignature

# replace the provision
cp "$PROVISION" Payload/*.app/embedded.mobileprovision

# generate entitlements for current app
cd Payload/
codesign -d --entitlements - *.app > entitlements.plist
cd ..
mv Payload/entitlements.plist entitlements.plist

# sign with the new certificate and entitlements
/usr/bin/codesign -f -s "$CERTIFICATE" '--entitlements' 'entitlements.plist'  Payload/*.app

# zip it back up
zip -qr resigned.ipa Payload
Run Code Online (Sandbox Code Playgroud)


Dha*_*ura 5

  1. 通过使用.zip更改扩展名来解压缩.ipa文件
  2. 转到有效负载。您会找到.app文件
  3. 右键单击.app文件,然后单击“显示包内容”
  4. 删除资料_CodeSigned
  5. embedded.mobileprovision新的配置文件替换文件
  6. 转到KeyChain Access并确保存在与临时配置文件关联的证书
  7. 执行以下命令: /usr/bin/codesign -f -s "iPhone Distribution: Certificate Name" --resource-rules "Payload/Application.app/ResourceRules.plist" "Payload/Application.app"

  8. 现在再次压缩Payload文件夹,并使用.ipa更改.zip扩展名

希望对您有所帮助。

供参考,请参见下面提到的链接:http : //www.modelmetrics.com/tomgersic/codesign-re-signing-an-ipa-between-apple-accounts/


hon*_*eng 1

试试这个应用程序 http://www.ketzler.de/2011/01/resign-an-iphone-app-insert-new-bundle-id-and-send-to-xcode-organizer-for-upload/

它应该可以帮助您退出 IPA 文件。我自己尝试过,但无法通过 Entitlements.plist 传递错误。可能只是我的项目有问题。你应该尝试一下。