Apps that has been installed from the AppStore are already signed by Apple and therefor can be run on the iOS, but if you done any changes to a IPA or install a 3rd party app you would need to sign it.
Another good guide to signing application can be found in the Objection Wiki:
https://github.com/sensepost/objection/wiki/Patching-iOS-Applications
To resign the application we would need to use applesign with a certificate
Generate a new iOS certificate using xcode (see Objection link above)
Extract the code signing certificate:
security find-identity -v -p codesigning
Note: if you getting error signing see 'Errors' Page
install: npm install -g applesign
Mobexler@Mobexler /tmp applesign
Usage:
applesign [--options ...] [target.ipa | Payload/Target.app]
-a, --all Resign all binaries, even it unrelated to the app
-b, --bundleid [BUNDLEID] Change the bundleid when repackaging
-c, --clone-entitlements Clone the entitlements from the provisioning to the bin
-f, --force-family Force UIDeviceFamily in Info.plist to be iPhone
-h, --help Show verbose help message
-H, --allow-http Add NSAppTransportSecurity.NSAllowsArbitraryLoads in plist
-i, --identity [1C4D1A..] Specify hash-id of the identity to use
-L, --identities List local codesign identities
-m, --mobileprovision [FILE] Specify the mobileprovision file to use
-o, --output [APP.IPA] Path to the output IPA filename
-O, --osversion 9.0 Force specific OSVersion if any in Info.plist
-p, --without-plugins Remove plugins (excluding XCTests) from the resigned IPA
-w, --without-watchapp Remove the WatchApp from the IPA before resigning
-x, --without-xctests Remove the XCTests from the resigned IPA
Example:
$ applesign -w -c -m embedded.mobileprovision target.ipa
iron@MacOS / % applesign SimpleApp_decrypted.ipa -B -c -d --identity R4G******* --mobileprovision embedded.mobileprovision -o signed_SimpleApp.ipa
File: /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa
Outdir: /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79
Cleaning up /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79
Unzipping /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa
Main IPA executable is not encrypted
Embedding new mobileprovision
{"application-identifier":"6B****.*","keychain-access-groups":["6B****.*","com.apple.token"],"get-task-allow":true,"com.apple.developer.team-identifier":"6B****"}
Cloning entitlements
get-task-allow set to true
Updated binary entitlements/var/folders/78/n8glt3614dq4b9jl0zszs_yh0000gn/T/applesign/24dde536-1343-4024-8095-de6e21f53bcf/SimpleApp.entitlements
Signing libraries and frameworks
Resolving signing order using layered list
[
'/Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79/Payload/SimpleApp.app/PlugIns/MostWatchedWidget.appex/MostWatchedWidget',
'/Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79/Payload/SimpleApp.app/PlugIns/iMessageExtension.appex/iMessageExtension'
]
Cannot resolve rpath for: @rpath/libswiftAVFoundation.dylib from /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79/Payload/SimpleApp.app/SimpleApp
Warning: Cannot resolve dependency library: /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79/Payload/SimpleApp.app/SimpleApp
Cannot resolve rpath for: @rpath/libswiftAccelerate.dylib from /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79/Payload/SimpleApp.app/SimpleApp
Warning: missing file: @rpath/libswiftAVFoundation.dylib
{"application-identifier":"6B****.*","keychain-access-groups":["6B****.*","com.apple.token"],"get-task-allow":true,"com.apple.developer.team-identifier":"6B****"}
Cloning entitlements
get-task-allow set to true
Updated binary entitlements/var/folders/78/n8glt3614dq4b9jl0zszs_yh0000gn/T/applesign/24dde536-1343-4024-8095-de6e21f53bcf/MostWatchedWidget.entitlements
Signed /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79/Payload/SimpleApp.app/PlugIns/MostWatchedWidget.appex/MostWatchedWidget
{"application-identifier":"6B****.*","keychain-access-groups":["6B****.*","com.apple.token"],"get-task-allow":true,"com.apple.developer.team-identifier":"6B****"}
Cloning entitlements
get-task-allow set to true
Updated binary entitlements/var/folders/78/n8glt3614dq4b9jl0zszs_yh0000gn/T/applesign/24dde536-1343-4024-8095-de6e21f53bcf/iMessageExtension.entitlements
Signed /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79/Payload/SimpleApp.app/Frameworks/Services.framework/Services
Signed /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79/Payload/SimpleApp.app/Frameworks/protobuf.framework/protobuf
Zipifying into /Users/iron/Documents/Project/SimpleApp/signed_SimpleApp.ipa ...
Cleaning up /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79
Target is now signed: /Users/iron/Documents/Project/SimpleApp/signed_SimpleApp.ipa
Cleaning up temp dir /var/folders/78/n8glt3614dq4b9jl0zszs_yh0000gn/T/applesign/24dde536-1343-4024-8095-de6e21f53bcf
Cleaning up /Users/iron/Documents/Project/SimpleApp/SimpleApp_decrypted.ipa.25115fb8-5a1f-4ed9-8ab4-6f13136d8a79
Note: if you getting error signing see 'Errors' Page
Install: sudo pip3 install objection