5 // Created by James Murphy on 12/11/12.
6 // Copyright (c) 2012 James Murphy. All rights reserved.
13 @interface PSCerts (PrivateMethods)
15 - (void)get_certs:(BOOL)forBadCerts;
19 @implementation PSCerts
21 @synthesize certs = _certs;
23 - (void)get_certs:(BOOL)forBad
25 if (nil != _cert_dir_path)
29 NSFileManager* fileManager = [NSFileManager defaultManager];
31 if (![fileManager fileExistsAtPath:_cert_dir_path isDirectory:&isDir] || !isDir)
36 NSDirectoryEnumerator* enumer = [fileManager enumeratorAtPath:_cert_dir_path];
42 for(NSString* cert_path_str in enumer)
44 if ([cert_path_str hasPrefix:@"."])
49 NSLog(@"Processing file %@", cert_path_str);
51 NSString* full_path = [_cert_dir_path stringByAppendingPathComponent:cert_path_str];
55 PSCertKey* aCertKey = [[PSCertKey alloc] initWithCertFilePath:full_path];
58 [_certs addObject:aCertKey.key_hash];
63 PSCert* aCert = [[PSCert alloc] initWithCertFilePath:full_path];
66 [_certs addObject:aCert.cert_hash];
75 - (id)initWithCertFilePath:(NSString *)filePath forBadCerts:(BOOL)forBad
77 if (self = [super init])
79 _cert_dir_path = filePath;
80 _certs = [NSMutableArray array];
81 [self get_certs:forBad];