resign .ipa with new distribution certificate
Assumptions:
- .ipa filename is app.ipa
- app is called MyApp
- new provisioning profile resides at: ~/Downloads/AdHoc.mobileprovision
- distribution certificate name is Company Certificate
- may not need resource-rules parameter
- provisioning profile is either for Adhoc, or Enterprise distribution
Commands:
unzip app.ipa
rm -rf Payload/MyApp.app/_CodeSignature/
cp ~/Downloads/AdHoc.mobileprovision Payload/MyApp.app/embedded.mobileprovision
codesign -f -s "iPhone Distribution: Company Certificate" --resource-rules Payload/MyApp.app/ResourceRules.plist Payload/MyApp.app
zip -qr app-resigned.ipa Payload/
Related protips:
Written by Jeffrey Jackson
Related protips
15 Responses
Perfect directions. Thanks! May I suggest that you note that the signing identity (-s) is the full name of the certificate as shown via the keychain tool.
One more thing... The codesign --entitlements option can be used to add entitlements to the binary. When I followed these directions without using --entitlements, I lost the original entitlements.
Hi Jeff,
Thank you for your post. pretty good.
Also, does this resining works for app store build ? I am finding way to resign the development build and upload it to app the store.
Thanks
If you run into issue like :
"cannot find code object on disk"
then set an environment variable
CODESIGNALLOCATE="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesignallocate"
NOTE : there is an underscore between codesign & allocate environment variable which is getting supressed for some reason.
I got an ipa and I re-signed it with EXPIRED provisioning profile (Enterprise) and with a valid certificate(.p12). using steps mentioned below :-
and Re-Sign it with steps provided by you
when I am extracting ipa (getting .App file) -> doing show package Contents (on .App) -> checking content of embedded.mobileprovision. it show same expired provisioning profile that i used to Re-sign the ipa.
Problem : I am successfully able to install it to ipad and able to run the app. Ideally App should not work with Expired provisioning profile.
Question : If we Re-signing the app through Command-line with Expired profile Will it work.?
Have you been able to codesign Today app extension?
What is the ResourceRules.plist? Is it mandatory? We have the Info.plist and I am not sure if signing without --resource-rules will work.
Also, how do you handle Entitlement files when resigning? I tried --entitlements /Path/to/My.entitlements, but it seems to have no effect
below issue
Warning: --resource-rules has been deprecated in Mac OS X >= 10.10!
Payload/MyApp.app/ResourceRules.plist: cannot read resources
below issue
Warning: --resource-rules has been deprecated in Mac OS X >= 10.10!
Payload/MyApp.app/ResourceRules.plist: cannot read resources
Great tutorial.
For those saying they have this error :
Warning: --resource-rules has been deprecated in Mac OS X >= 10.10!
Payload/MyApp.app/ResourceRules.plist: cannot read resources
Just get rid of the resource-rules parameter.
Any update on the latest versions ? I tried that on the latest iOS and I followed the steps and all nice until the last part when to install it fails .
Thanks .
Hi,
I received .ipa file from developer.I am new to iOS testing, Can you please let me know how to create or where to find provisioning profile and Company certificate.
Wow, Really great post i enjoy it very much here I appreciating your knowledge keep sharing kindly check it out
https://kathrynhemphill199.wixsite.com/hanumanchalisalyrics
Hello,
Thanks for your post. I have one question about iphone distribution. can i use distribution that is not relate to provisioning profile ?
Thank you a lot again,
Third command is not working for me, showing below:
1- If i give identity within "" (as shown ) , It just hangs .
2- Then I put identity without double quotes, then resource-rules related waring as below:
Warning: --resource-rules has been deprecated in Mac OS X >= 10.10!
3- Then I removed --resource-rules parameter, and ran command :
$codesign -f -s iPhone Distribution: Company Certificate Payload/MyApp.app/ResourceRules.plist Payload/MyApp.app
Getting below error:
Distribution:: No such file or directory
Tried putting absolute path for Payload/MyApp.app but no luck.
Please suggest.