title: CodeSigning an IPA file using only Windows
body: <p>For a future project I need to learn how works the codesigning process for Apple iOS IPA files (iPhone/iPad).
  The goal of my project will be to build (in Delphi) a Windows tool to codesign one IPA file (previously compiled with "<em>Don't Code Sign</em>" via XCode).</p>
  
  <p>One sure thing, it's that is possible to codesign an IPA file only on Windows ; like Adobe does with AIR/Flash CS5. Also, Epic Games, Inc. built the UDK (Unreal Development Kit) with a third party tool to codesign IPA files.</p>
  
  <p>This last one was coded in C#/.NET, so I tried to explore the source-code to learn how the codesigning process works but, wow, the code is fairly evolved and even if there are significant similarities between C#/.NET and Delphi, I'm quickly in the blur...</p>
  
  <p>The iPhonePackager from UDK is really close to what I want to do (with less features).</p>
  
  <p>From my research : certificates and keys can be "generated" via OpenSSL in command-line ; Apple uses X509 certificates to codesign the binary (?) ; a component like <em>Bouncy Castle Crypto</em> APIs can be used to manage certificates.</p>
  
  <p>An interesting article about the codesigning process from Apple : <a href="http://developer.apple.com/library/mac/#technotes/tn2206/_index.html">http://developer.apple.com/library/mac/#technotes/tn2206/_index.html</a></p>
  
  <p>Also I'll have to generate, the "<em>CodeResources</em>" ; the "<em>embedded.mobileprovision</em>" from the Mobile Provisioning file ; and the "<em>CodeSignature/CodeResources</em>" with the hierarchy of all files like :</p>
  
  <pre><code>&lt;key&gt;MainWindow.nib&lt;/key&gt;
  &lt;data&gt;GTBfZPINlJlD7HXjMRAKgfAztXU=&lt;/data&gt;
  </code></pre>
  
  <p><strong>If you read so far, you should definitely have a headache :)</strong> <br>
  So, below are few questions to start...</p>
  
  <p>Is it possible to re-sign a binary already compiled and signed with "<em>Don't Code Sign</em>" ?<br>
  Do you think my project is a really hard job... ?<br>
  Do you think it will be better for me to hire a developer ? I can have a budget for this project but ideally I would like to do it by myself of course... :D</p>
  
  <p>Many thanks in advance for advices and/or suggestions.</p>
  
  <p>Beny</p>