Skip to content

Instantly share code, notes, and snippets.

@lodalo
Last active December 6, 2023 05:06
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save lodalo/754a35b48d382ae99b25 to your computer and use it in GitHub Desktop.
Save lodalo/754a35b48d382ae99b25 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
@Mengfigu
Copy link

Mengfigu commented Mar 8, 2023

#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

@Mengfigu
Copy link

Mengfigu commented Mar 8, 2023

#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