 *
 * Copyright (C) 2007 iZsh 
 * 
 * This software is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU General Public License version 2 for more details
 *

=====================================================================
IMPORTANT NOTE ABOUT THE SOURCE:
=====================================================================
I'm releasing the source code under GPL, it means that I would
appreciate if people could actually
- give feedbacks, suggestions...
- use it in GPL softwares instead of "rewriting" it to go around the
  GPL license. That really doesn't encourage distributing the
  sources. And then it's your loss not mine.
  If you have a really compelling reason not to release a software
  under GPL but would like to use some code from this software (or
  get highly "inspired" from it) please contact me to talk about it
  first.

Credit for MobileDevice.h goes to Nightwatch.
MobileDevice's API and protocol reversing credits go to Nightwatch,
Roxfan and myself (this was mainly done during the first week after
the release).
I took a look at geo's/ixtli's code too to debug the "filesize"
function.

Thanks
=====================================================================

This tool just generates an activation plist file given a private RSA
key. Of course you need to overwrite the certificate from the
iPhone with the proper public one.

Nothing extraordinary, just useful.

For your convenience, iPhoneActivation.pem (public certificate)
and iPhoneActivation_private.pem (private key ;) ) are
provided. Once you escape the chroot/jail sandbox, copy
iPhoneActivation.pem to /System/Library/Lockdown/iPhoneActivation.pem

If you don't know how to break the jail, you shouldn't probably
use this tool in the first place.

Usage:
* ./iASign.mac --state
  Get the current activation state.
 
* ./iASign.mac --deactivate 
  Deactivate the iPhone.

* ./iASign.mac --backup <filename>
  Backup the current activation token out of the iPhone.
  Very useful if you have a real AT&T activated phone and you still
  want to play around with it without losing your activation.

* ./iASign.mac --automatic <private key file>
  Automatically activate your phone.
  You need to have your SIM in there (to be able to retrieve the values
  for you). All the information are retrieved from the phone (including
  the DeviceID).
  So yeah... you don't need to really know where to get those values from...
  Enjoy! ;)

./iASign.mac --generate <private key file> <DeviceID> <IMEI> <ICCID> <out_filename>
  Generate the plist file.
  Could be useful to play around.

./iASign.mac --fromxml <filename>
  Activate using a generated or saved plist file.

FAQ:
Q: How can I automatically generate a plist file from my current SIM to
   play with it?
A: Use the --automatic option and then use --backup to get it back

Compilation:
Mac OS X: make -f Makefile.mac
Win: make -f Makefile.win (not yet working)

Special cheers to the dev team.

-- iZsh

PS: Oh and by the way, iASign stands for "Activation Signature" ;)
