5 // Created by James Murphy on 12/12/12.
6 // Copyright (c) 2012 James Murphy. All rights reserved.
10 #import <Security/Security.h>
11 #import "PSUtilities.h"
13 @implementation PSCertKey
15 @synthesize key_hash = _key_hash;
18 - (id)initWithCertFilePath:(NSString *)filePath
20 if ((self = [super init]))
24 CFDataRef temp_cf_data = [PSUtilities readFile:filePath];
25 if (NULL == temp_cf_data)
27 NSLog(@"PSCertKey: Unable to read data for file %@", filePath);
31 SecCertificateRef aCert = [PSUtilities getCertificateFromData:temp_cf_data];
32 CFRelease(temp_cf_data);
35 CFDataRef temp_key_data = [PSUtilities getKeyDataFromCertificate:aCert];
36 if (NULL != temp_key_data)
38 _key_hash = [PSUtilities digestAndEncode:temp_key_data useSHA1:YES];
39 CFRelease(temp_key_data);