Sign IPA with installed Apple developer license

You should have iOS SDK, iPhone/iPad developer certification and provision profile installed on your Mac before trying this script.
Note: Only tested with a few .IPA files myself so far, use it properly at your own risk.
Updated: added support for key chain, moved to Gist.