From e8e19884cee5aeb1e564e2f842920a4c62aa7e81 Mon Sep 17 00:00:00 2001 From: Matt Colyer Date: Thu, 14 Aug 2008 22:35:41 -0700 Subject: Fixes initconf. --- README | 18 ++++++------------ src/Makefile.am | 4 ++-- src/initconf.c | 42 ++++++++++++++++++++++++------------------ 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README b/README index f387f69..ee724f8 100644 --- a/README +++ b/README @@ -13,24 +13,20 @@ You must have: autoconf gcc -IMPORTANT: You must edit src/ifuse.c and src/main.c and replace your HostID -from the plist file stored by iTunes. You can find these lines because they are -currently commented out. In Windows this file is located in: - -C:\Documents and Settings\Your Username\Application Data\Apple Computer\Lockdown\.plist - -IMPORTANT: You must also have a public certificate for the device located in -the root directory of the source named hostcert.pem. This can also be extracted -from the above file. - To compile run: ./autogen.sh ./configure make + sudo make install (if you want to install it into your system directories) + libiphone-initconf (as the user you intend to user the library) USAGE ================================================================================ +IMPORTANT: Before using the library you must run "libiphone-initconf". It will +generate keys and a host id for your system. It only needs to be run once but +it MUST be run. + There are currently 2 executables iphoneclient and ifuse, located in src/. iphoneclient is a basic commandline interface, it just runs a few various operations. @@ -43,5 +39,3 @@ like this: To unmount: umount mountpoint -Currently the ifuse filesystem is read-only, until the development has -progressed further. diff --git a/src/Makefile.am b/src/Makefile.am index 2817394..09d232f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ AM_CFLAGS = $(libxml2_CFLAGS) $(libusb_CFLAGS) $(libglib2_CFLAGS) $(libfuse_CFLAGS) $(libgnutls_CFLAGS) -g AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libfuse_LIBS) $(libgnutls_LIBS) -bin_PROGRAMS = iphoneclient ifuse initconf +bin_PROGRAMS = iphoneclient ifuse libiphone-initconf iphoneclient_SOURCES = usbmux.c main.c iphone.c plist.c lockdown.c AFC.c userpref.c ifuse_SOURCES = ifuse.c usbmux.c iphone.c plist.c lockdown.c AFC.c userpref.c -initconf_SOURCES = initconf.c userpref.c +libiphone_initconf_SOURCES = initconf.c userpref.c diff --git a/src/initconf.c b/src/initconf.c index 795b4ac..b4952e7 100644 --- a/src/initconf.c +++ b/src/initconf.c @@ -52,10 +52,13 @@ char *lockdownd_generate_hostid() { } int main(int argc, char *argv[]) { + + printf("This program generates keys required to connect with the iPhone\n"); + printf("It only needs to be run ONCE.\n\n"); + printf("Additionally it may take several minutes to run, please be patient.\n\n"); gnutls_global_init(); - size_t size; char* host_id = NULL; gnutls_x509_privkey_t root_privkey; gnutls_x509_privkey_t host_privkey; @@ -72,11 +75,17 @@ int main(int argc, char *argv[]) { /* generate HostID */ //TODO host_id = lockdownd_generate_hostid(); - if (debug) printf("HostID: %s\n", host_id); /* generate keys */ + printf("Generating root key..."); + fflush(stdout); gnutls_x509_privkey_generate(root_privkey, GNUTLS_PK_RSA, 2048, 0); + printf("done\n"); + + printf("Generating private key..."); + fflush(stdout); gnutls_x509_privkey_generate(host_privkey, GNUTLS_PK_RSA, 2048, 0); + printf("done\n"); /* generate certificates */ gnutls_x509_crt_set_key(root_cert, root_privkey); @@ -102,34 +111,31 @@ int main(int argc, char *argv[]) { gnutls_datum_t root_key_pem = {NULL, 0}; gnutls_datum_t host_key_pem = {NULL, 0}; - gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, NULL, &size); - root_key_pem.size = size; - gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &size); - host_key_pem.size = size; + gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, NULL, &root_key_pem.size); + gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &host_key_pem.size); root_key_pem.data = gnutls_malloc(root_key_pem.size); host_key_pem.data = gnutls_malloc(host_key_pem.size); - gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &size); - root_key_pem.size = size; - gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &size); - host_key_pem.size = size; + gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &root_key_pem.size); + gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &host_key_pem.size); gnutls_datum_t root_cert_pem = {NULL, 0}; gnutls_datum_t host_cert_pem = {NULL, 0}; - gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, NULL, &size); - root_cert_pem.size = size; - gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &size); - host_cert_pem.size = size; + gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, NULL, &root_cert_pem.size); + gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &host_cert_pem.size); root_cert_pem.data = gnutls_malloc(root_cert_pem.size); host_cert_pem.data = gnutls_malloc(host_cert_pem.size); - gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &size); - root_cert_pem.size = size; - gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &size); - host_cert_pem.size = size; + printf("Generating root certificate..."); + gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &root_cert_pem.size); + printf("done\n"); + + printf("Generating root certificate..."); + gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &host_cert_pem.size); + printf("done\n"); /* store values in config file */ -- cgit v1.1-32-gdbae