#1306 - Moving api_mapbox_com.der to iOS Resources directory so that it can be accessed via GL Framework

This commit is contained in:
Brad Leege
2015-04-20 19:47:24 -05:00
parent 96a6371fa0
commit 6f9bcd86af
3 changed files with 16 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
'type': 'none',
'hard_dependency': 1,
'copies': [{
'files': [ '../common/api_mapbox_com.der', '../common/ca-bundle.crt' ],
'files': [ '../common/ca-bundle.crt' ],
'destination': '<(PRODUCT_DIR)'
}],
},

View File

@@ -649,8 +649,21 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
// Load Local Copy of Server's Public Key
// NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"b.ssl.fastly.net" ofType:@"der"];
NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"api_mapbox_com" ofType:@"der"];
NSString *cerPath = nil;
NSArray *bundles = [NSBundle allFrameworks];
for (int lc = 0; lc < bundles.count; lc++) {
NSBundle *b = [bundles objectAtIndex:lc];
cerPath = [[NSBundle mainBundle] pathForResource:@"api_mapbox_com" ofType:@"der"];
if (cerPath != nil) {
break;
}
}
if (cerPath == nil) {
NSLog(@"cerPath not found.");
return;
}
// NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"api_mapbox_com" ofType:@"der"];
NSData *localCertData = [NSData dataWithContentsOfFile:cerPath];
// Get Server's Public Key
@@ -671,7 +684,6 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
}
long numKeys = SecTrustGetCertificateCount(serverTrust);
NSLog(@"Number of certificaties presented: %ld", numKeys);
BOOL found = false;
for (int lc = 0; lc < numKeys; lc++) {