So, as you may have noticed if you’ve built iPhone apps for anyone other than yourself, it’s a bit of a challenge to coordinate program memberships, distribution certificates, yadayadayada. Wouldn’t it be convenient to just build the app using your own certificate and then have them sign the build for their devices, distribution, etc. on their own, without them having to trust you with their certificates and/or account access, or you adding their devices into your account?
Well, turns out that actually is possible — if you have a signing certificate of your own installed, you can take an arbitrarily signed binary you’ve been sent by whomever and overwrite its signature with your own. Handy, that, don’t you think? Here’s full details, and the man page, but the essence is simple: start up Terminal, and
export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
to recognize iPhone ARM binaries, then simply cd into TargetApp.app and
codesign -f -s "iPhone Developer" -vv TargetApp
It’ll say
TargetApp: signed Mach-O thin (armv6) [TargetApp]
and that’s it, you now have a re-signed binary suitable for iTunes synchronization. Besides making builds with your certificate for other people to test without needless trust and/or inconvenience, this is also a handy way to test the final distribution build of your application before submitting to Apple, besides testing application binaries signed with any other certificate that you don’t have access to. Convenient, indeed!
h/t: xcode-users!
MAY
Pingback: Tip: Code Signing