]> git.saurik.com Git - apple/security.git/blob - certificates/ota_cert_tool/ios_ota_cert_tool/PSCert.m
Security-57031.30.12.tar.gz
[apple/security.git] / certificates / ota_cert_tool / ios_ota_cert_tool / PSCert.m
1 //
2 // PSCert.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 "PSCert.h"
10 #import "PSUtilities.h"
11
12 @implementation PSCert
13
14 @synthesize cert_hash = _cert_hash;
15
16
17 - (id)initWithCertFilePath:(NSString *)filePath
18 {
19 if ((self = [super init]))
20 {
21 _cert_hash = nil;
22
23 CFDataRef temp_cf_data = [PSUtilities readFile:filePath];
24 if (NULL == temp_cf_data)
25 {
26 NSLog(@"PSCert: Unable to read data for file %@", filePath);
27 return nil;
28 }
29 _cert_hash = [PSUtilities digestAndEncode:temp_cf_data useSHA1:NO];
30 CFRelease(temp_cf_data);
31 }
32 return self;
33 }
34
35
36
37 @end