Intoduction
This code allow you to resign your own ipa assuming that you have:
1) a developer certificate issued by apple and added to your keychain
2) a mobileprovision file
1) a developer certificate issued by apple and added to your keychain
2) a mobileprovision file
This code allow you to resign your app without using xcode or if you need to add a UDID for development distribution.
This code correctly signs ipas with Frameworks (.framework folders), Plugins (.appex folders),Applications (.app folders)
This code autoincludes entitlements with binaries extracting them from the provided mobileprovision file.
This code correctly signs ipas with Frameworks (.framework folders), Plugins (.appex folders),Applications (.app folders)
This code autoincludes entitlements with binaries extracting them from the provided mobileprovision file.
Usage
This code runs on mac osx
You should already have installed OSX Command Lines Tools
The code is a shell script
You should already have installed OSX Command Lines Tools
The code is a shell script
Step 1
Change the following variables inside the signall.sh script:
signscript="/path/to/sign.sh"
ipasourcefolder="path/to/ipas/source/folder"
ipadestfolder="/path/to/ipas/destinations/folder/"
developer1="iPhone Developer: xxxxx (xxxxx)"
mobileprovision1="/path/to/mobile/provision"
signscript="/path/to/sign.sh"
ipasourcefolder="path/to/ipas/source/folder"
ipadestfolder="/path/to/ipas/destinations/folder/"
developer1="iPhone Developer: xxxxx (xxxxx)"
mobileprovision1="/path/to/mobile/provision"
Step 2
make sure that ipasourcefolder and ipadestfolder are writable
run signall.sh via terminal
done
run signall.sh via terminal
done
In your destination folder you will have all your ipas signed.
PHP Code:
Bitbucket source and updates : https://bitbucket.org/xgiovio/ios-ipa-resign/src
PHP Code:
# !/bin/bash
signscript="/path/to/sign.sh"
ipasourcefolder="path/to/ipas/source/folder"
ipadestfolder="/path/to/ipas/destinations/folder/"
developer1="iPhone Developer: xxxxx (xxxxx)"
mobileprovision1="/path/to/mobile/provision"
cd $ipasourcefolder
find -d . -type f -name "*.ipa"> files.txt
while IFS='' read -r line || [[ -n "$line" ]]; do
filename=$(basename "$line" .ipa)
echo "Ipa: $filename"
#_dev1_______
output=$ipadestfolder$filename
output+="_signed_dev1.ipa"
"$signscript" "$line" "$developer1" "$mobileprovision1" "$output"
done < files.txt
rm files.txt
sign.sh
PHP Code:
# !/bin/bash
SOURCEIPA="$1"
DEVELOPER="$2"
MOBILEPROV="$3"
TARGET="$4"
unzip -qo "$SOURCEIPA" -d extracted
APPLICATION=$(ls extracted/Payload/)
cp "$MOBILEPROV" "extracted/Payload/$APPLICATION/embedded.mobileprovision"
echo "Resigning with certificate: $DEVELOPER" >&2
find -d extracted \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt
security cms -D -i "extracted/Payload/$APPLICATION/embedded.mobileprovision" > t_entitlements_full.plist
/usr/libexec/PlistBuddy -x -c 'Print:Entitlements' t_entitlements_full.plist > t_entitlements.plist
#/usr/libexec/PlistBuddy -c 'Print:application-identifier' t_entitlements.plist > t_entitlements_application-identifier #save developer application-identifier to file
#/usr/libexec/PlistBuddy -c 'Print:com.apple.developer.team-identifier' t_entitlements.plist > t_entitlements_com.apple.developer.team-identifier #save com.apple.developer.team-identifier application-identifier to file
while IFS='' read -r line || [[ -n "$line" ]]; do
#/usr/bin/codesign -d --entitlements :- "$line" > t_entitlements_original.plist #save original entitlements from the app
#/usr/libexec/PlistBuddy -x -c 'Import application-identifier t_entitlements_application-identifier' t_entitlements_original.plist #overwrite application-identifier
#/usr/libexec/PlistBuddy -x -c 'Import com.apple.developer.team-identifier t_entitlements_com.apple.developer.team-identifier' t_entitlements_original.plist #overwrite com.apple.developer.team-identifier
/usr/bin/codesign --continue -f -s "$DEVELOPER" --entitlements "t_entitlements.plist" "$line"
done < directories.txt
echo "Creating the Signed IPA"
cd extracted
zip -qry ../extracted.ipa *
cd ..
mv extracted.ipa "$TARGET"
rm -rf "extracted"
rm directories.txt
rm t_entitlements.plist
rm t_entitlements_full.plist
#rm t_entitlements_original.plist
#rm t_entitlements_application-identifier
#rm t_entitlements_com.apple.developer.team-identifier
Comment