Skip to content

Instantly share code, notes, and snippets.

@ShiYuanjun-Tim
Forked from lodalo/re-sign iOS IPA
Created February 16, 2023 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShiYuanjun-Tim/015833f20b89323f48f89b60a0c8b071 to your computer and use it in GitHub Desktop.
Save ShiYuanjun-Tim/015833f20b89323f48f89b60a0c8b071 to your computer and use it in GitHub Desktop.
Steps to re-sign an IPA file with a new provisioning profile
#Unzip the IPA
unzip Application.ipa
#Remove old CodeSignature
rm -R "Payload/Application.app/_CodeSignature"
#Replace embedded mobile provisioning profile
cp "path-to-provisioning-profile/MyEnterprise.mobileprovision" "Payload/Application.app/embedded.mobileprovision"
#If you are resigning to submit to the AppStore you need to extract the entitlements to use later
#extract entithements
/usr/bin/codesign -d --entitlements :entitlements.plist Payload/Application.app
#determine the identity name to use for the next step
security find-identity -pcodesigning -v
#Re-sign with entitlements
/usr/bin/codesign -f -s "iPhone Distribution: Certificate Name" --entitlements entitlements.plist "Payload/Application.app"
# OR Re-sign without entitlements
/usr/bin/codesign -f -s "iPhone Distribution: Certificate Name" "Payload/Application.app"
#Now, to verify what you have, you can do:
codesign -dvvv --entitlements - Payload/Application.app
#Re-package
zip -qr "Application.resigned.ipa" Payload
###OR you can use a GUI tool like AirSign (commercial) or iReSign (free).
#Tutorial for using iReSign: http://dev.mlsdigital.net/posts/how-to-resign-an-ios-app-from-external-developers/
###
#Parts of this gist were adapted from: http://stackoverflow.com/questions/15634188/resigning-an-ios-provisioning-profile
#Useful information about including entitlements is found at the iReSign tutorial and also
# here: http://stackoverflow.com/questions/6896029/re-sign-ipa-iphone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment