10

I have some apps i wanna resign with a different apple developer license,

Problem is, i dont have source code, only the ipa file, the app and the archiveinfo.plist is it possible for me to resign the app if i dont have the source code?

Thanks! Ompah

Ompah
  • 191
  • 2
  • 2
  • 6
  • You can try [www.aironapp.com](http://www.aironapp.com). It can do recodesigning of the IPA's automatically. You need to configure your Apple account first (upload certificate and private keys). – shader Jun 07 '12 at 10:43
  • Simple shell script answer: http://stackoverflow.com/a/10905855/190599 – CodeReaper Jan 14 '14 at 13:01

2 Answers2

22

The ability to replace the signature on an already-signed binary is built into the codesign utility. That way, if your developer certificate expires (as they do annoyingly often), you don't have to rebuild your app.

This can be important, especially if you need to support an old app version, and you've made code alterations since you archived your IPA.

I usually use this script. It comes in handy when trading debug build IPAs with people who have their own developer accounts and who I don't want to burn a UDID slot for, and who don't want to have to load my provisioning profiles on their devices.

#!/bin/sh

TEMPDIR=/tmp/$RANDOM-$RANDOM-$RANDOM
RESOURCERULES=/tmp/ResourceRules-$RANDOM$RANDOM.plist
CURRENTDIR=`pwd`

mkdir -p "$TEMPDIR"

cat - > "$RESOURCERULES" <<ResourceRulesPlistDelimiter
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>rules</key>
    <dict>
        <key>.*</key>
        <true/>
        <key>Info.plist</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>10</real>
        </dict>
        <key>ResourceRules.plist</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>100</real>
        </dict>
    </dict>
</dict>
</plist>
ResourceRulesPlistDelimiter

unzip -q "$1" -d "$TEMPDIR" || exit 1
xattr -d -r com.apple.quarantine "$TEMPDIR"

for APPBUNDLE in "`find "$TEMPDIR" -name "*.app"`"; do
    codesign --resource-rules="$RESOURCERULES" -f -s "iPhone Developer" "$APPBUNDLE"
    codesign -dvvvv -r- "$APPBUNDLE"
done

cd "$TEMPDIR"
zip -qr "$TEMPDIR.zip" "Payload" && cd "$CURRENTDIR" && mv "$1" "$1.bak" && mv "$TEMPDIR.zip" "$1"
cd "$CURRENTDIR"
rm -rf "$TEMPDIR.zip"
rm -rf "$TEMPDIR"
rm -rf "$RESOURCERULES"
Reid Rankin
  • 1,078
  • 8
  • 26
  • Cool, thanks man! But how do i use the script :) I have an ipa with com.something.something and i wanna change to com.mycompany.something would that be possible? – Ompah Jul 13 '11 at 07:45
  • Yes. Just change it in the Info.plist. I signed a test app with the ID com.apple.iBooks yesterday just to see what would happen, and it worked fine. – Reid Rankin Jul 13 '11 at 19:24
  • Save the script as a text file, go into the terminal, cd into the script's directory, chmod +x NameOfFile.sh, and then run ./NameOfScript.sh IPAName.ipa – Reid Rankin Jul 13 '11 at 19:25
  • BTW, the IPA is a zip file with a single directory named "Payload". Inside that dir is the Info.plist file to change. – Reid Rankin Jul 13 '11 at 19:26
  • Awesome, I would not have read this and favorited this question if someone had not downvoted my answer. +1 to you anyways. – Praveen S Jul 14 '11 at 10:51
2

This is the most effective and efficient solution I have come up with so far.

  1. Make sure you are using a Mac. This process requires an application for Mac OSX.

  2. Take the .ipa file, rename it to a .zip file.

  3. Extract the zip file, you will see a folder called “Payload” containing a .app file.

  4. Download the Mac OSX app AppResigner here: http://www.gorbster.net/misc/AppResigner.app.zip

  5. Unzip the app. Inside the unzipped folder you will see the Mac App “AppResigner”

  6. Open this app. It will ask you to choose a file. Choose the .app we unzipped from the .ipa file.

  7. It will ask you for a signing identity. Open the Mac App “Keychain Access”. The steps that you will take here may vary slightly. Open the keychain “login” and choose category “Certificates”

  8. Here you need to find the certificate with which you want to resign the app. For example it could be: “iPhone Distribution: Your Company Name”, you will need to have access to your company’s Distribution profile to use a distribution certificate. I have not tried doing this with a development certificate, I don't know if that will work.

  9. Type in this certificate name exactly as it is shown here into the AppResigner prompt; copy / paste was not working correctly for me.

  10. AppResigner should tell you that the app has been resigned.

  11. Find the .app file that you resigned (it is the same one as before) and zip it up. I use the Mac OSX program Keka, but many are available.

  12. Rename the zip file to a .ipa file.

  13. Done!

Joel Fischer
  • 6,521
  • 5
  • 35
  • 46
  • Also for mountain lion users, add below line too: export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate" – Meet Jul 30 '13 at 10:39