]> git.saurik.com Git - apple/security.git/blob - certificates/ota_cert_tool/ios_ota_cert_tool/main.m
Security-57031.1.35.tar.gz
[apple/security.git] / certificates / ota_cert_tool / ios_ota_cert_tool / main.m
1 //
2 // main.m
3 // ios_ota_cert_tool
4 //
5 // Created by James Murphy on 12/11/12.
6 // Copyright (c) 2012 James Murphy. All rights reserved.
7 //
8
9 #import <Foundation/Foundation.h>
10 #import "PSIOSCertToolApp.h"
11
12 /*
13 printf("%s usage:\n", [self.app_name UTF8String]);
14 printf(" [-h, --help] \tPrint out this help message\n");
15 printf(" [-r, --roots_dir] \tThe full path to the directory with the certificate roots\n");
16 printf(" [-k, --revoked_dir] \tThe full path to the directory with the revoked certificates\n");
17 printf(" [-d, --distrusted_dir] \tThe full path to the directory with the distrusted certificates\n");
18 printf(" [-c, --certs_dir] \tThe full path to the directory with the cert certificates\n");
19 printf(" [-e, --ev_plist_path] \tThe full path to the EVRoots.plist file\n");
20 printf(" [-t, --top_level_directory] \tThe full path to the top level security_certificates directory\n");
21 printf(" [-o, --output_directory] \tThe full path to the directory to write out the results\n");
22 printf("\n");
23 */
24
25 int main(int argc, const char * argv[])
26 {
27 //#define HARDCODE 1
28
29 #ifdef HARDCODE
30
31 const char* myArgv[] =
32 {
33 "foo",
34 "--top_level_directory",
35 "~/PR-10636667/security/certificates",
36 "--output_directory",
37 "~/cert_out"
38 };
39
40 int myArgc = (sizeof(myArgv) / sizeof(const char*));
41
42 argc = myArgc;
43 argv = myArgv;
44 #endif // HARDCODE
45
46
47 @autoreleasepool
48 {
49 PSIOSCertToolApp* app = [[PSIOSCertToolApp alloc] init:argc withArguments:argv];
50 if (![app processCertificates])
51 {
52 NSLog(@"Could not process the certificate directories");
53 return -1;
54 }
55
56 if (![app outputPlistsToDirectory])
57 {
58 NSLog(@"Could not output the plists");
59 return -1;
60 }
61
62 if (![app validate])
63 {
64 NSLog(@"Could not validate the output plists");
65 return -1;
66 }
67
68 }
69 return 0;
70 }
71