lefteros_by SomniusX
EL ↗Say hello

LEFTEROS / PERSONAL NOTES

iPhone Code Sign – Cydia & AppStore Deployment

19 May 2011 / Lefteris Iliadis / SomniusX

Historical text from HellasProject (2009–2014). It is not current advice or a present-day service.

I am posting an old article of mine from February 2010 about iPhone code sign. I know it should have been here on HellasProject earlier; that happened because I bought my own license and simply left the “fake” code-sign topic aside. Enjoy it, you know who you are!

I open this because there is a lot of noise on many internet pages about Code Signing, a process of digitally signing and certifying apps that go to the App Store or, if you like, to Cydia!

Now, if you have taken the Developer License from mama Apple, she will have given you a digital copy of the certificate you use in Xcode and in your Keychain to stamp your apps.

Now, for the fake code signing done by people who just want to try the app they are developing on their iPhone without deploying to the App Store, and who may only want Cydia for devices that have first been jailbroken!

  • How we create a fake code sign from Keychain Access,
  • how we change Xcode so it believes it has the signature with simple Project Settings entries,
  • and how we get past build problems.
  • How we can use Saurik’s Link Identity (ldid) so the codesign hashes let those apps run straight on jailbroken devices
  • and more..

You will gradually find all of the above in this post, and comments, suggestions, and your own ways to get the “job” done right would be welcome!

Let’s go..

At the link below you will find how you can bypass the code signature and package your app for Cydia

http://adeem.me/blog/2009/03/29/bypass-code-signature-published-your-application-on-cydia/

as well as YouTube videos that roughly show what is needed..

Creating Certificate from keychain access (Part 1)

Creating Xcode Template Project, changing in info.plist and adding few attributes inside Xcode info screen (Part 2).
[Note: I got some error because of wrong certificate and then i create it again using Part 1 video and it start working)

Select the right certificate and build your application. After build analysis the results and verify that everything was ok (Part 3).

Now.. to build correctly for the iPhone so you can ship an app to Cydia (AND NOT TO the App Store) and transfer it, you need a specific Xcode and iPhone SDK version..

to be more specific.. you need Xcode 3.1.3 and iPhone SDK 3.0 (at least; you can use newer, but success is certain with these). You need to download them separately and install Xcode first to /Developer and then the iPhone SDK again to /Developer

then a few lines need to be added to an Info.plist so provisioning works (WARNING: IF YOU HAVE A LICENSE FROM APPLE you must reverse the changes for builds to work correctly..)

go to

/Developer/Platforms/iPhoneOS.platform/Info.plist

and change it to look like the following, adding what is in red..

OverrideProperties CODE_SIGN_CONTEXT_CLASS XCiPhoneOSCodeSignContext DEBUG_INFORMATION_FORMAT dwarf-with-dsym EMBEDDED_PROFILE_NAME embedded.mobileprovision SDKROOT iphoneos2.2.1 PROVISIONING_PROFILE_ALLOWED NO PROVISIONING_PROFILE_REQUIRED NO

Then you must make a Certificate as in [Apple’s guide]( "External link"), naming it e.g. "iPhone Pwned Developer"

remember to restart Xcode after that..

then in your Project you must edit Info.plist as text and under the last values add

SignerIdentity Apple iPhone OS Application Signing

Then go to Project Settings and tell it to Code Sign, and under Other write the name of the Certificate you made, e.g. "iPhone Pwned Developer", for both debug and release..
before you take the last build step (build only, not build & go)
close Xcode, open Terminal, and as root e.g. with sudo give the following so Xcode drops what it does not need

bash script here

#!/bin/bash cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS\ Build\ System\ Support.xcplugin/Contents/MacOS/ dd if=iPhoneOS\ Build\ System\ Support of=working bs=500 count=255 printf "\x8f\x2a\x00\x00" >> working dd if=iPhoneOS\ Build\ System\ Support of=working bs=1 skip=127504 seek=127504 /bin/mv -n iPhoneOS\ Build\ System\ Support iPhoneOS\ Build\ System\ Support.original /bin/mv working iPhoneOS\ Build\ System\ Support chmod a+x iPhoneOS\ Build\ System\ Support

If you followed those steps you could build for iPhone Device 3.0 (which also runs on 3.1, 3.1.2 etc.) and you would find your file in the project folder under build, then iphoneos release, as name.app; you transfer that to the iPhone via SSH or some other SFTP program and put it in /Applications as /Applications/name.app.

From Cydia you should install ldid (search for link identity; you will also find it as ldid) and via MobileTerminal or SSH enter the device shell, go to /Applications/name.app/, and on the name binary give

ldid -S name

(capital -S) Saurik’s program, to patch the app so it does not look for a digital signature and can be executed..

Then do a respring (e.g. killall SpringBoard from the shell)

Now.. you will say..

"friend all good so far I compile my project it compiles and as soon as I send it to my iphone it shows a message, I have SDK 3.1.3 Snow Leopard, I have it on No-Codesign"

I mention above, because of provisioning problems, only BUILD for the iPhone and copy with ssh or winscp to the iPhone and from there fake code sign again with ldid etc..

That way it will NOT go to the iPhone.. and if it does it will not run..

That is it friends, good luck and successful creations!