Announcement

Collapse
No announcement yet.

Resign your iOS ipa (Frameworks and Plugins included)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resign your iOS ipa (Frameworks and Plugins included)

    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
    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.
    Usage
    This code runs on mac osx
    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"
    Step 2
    make sure that ipasourcefolder and ipadestfolder are writable
    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 
    signall.sh
    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 
    -. -type f -name "*.ipa"files.txt
      
    while IFS='' read -r line || [[ -"$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" --name "*.appex" --name "*.framework" --name "*.dylib" \) > directories.txt
    security cms 
    --"extracted/Payload/$APPLICATION/embedded.mobileprovision" t_entitlements_full.plist
    /usr/libexec/PlistBuddy --'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 || [[ -"$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 --"$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 
    | VFX Artist, C++ Programmer, HW Overclocker | Web: xgiovio.com Email: xgiovio@gmail.com Twitter: @xgiovio

  • #2
    Does this code work on all versions of iOS?

    Comment

    Working...
    X

    Google Profile


    My name is Giovanni Di Grezia, but people call me xgiovio.

    Here is my homepage:.

    I'm a VFX Artist and Software Developer.

    Giovanni Di Grezia