aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jorge Canizales <jcanizales@google.com>2015-03-23 15:37:35 -0700
committerGravatar Jorge Canizales <jcanizales@google.com>2015-04-21 17:59:25 -0700
commit6465c3404556fe38a6516b068b2b26f049a1d14b (patch)
treec68687beb7915c0dd5c74a64820ca026239418cf /src
parentbb58d224e7a2500502c3ebc31fe198ae98487a34 (diff)
Loads certificates from file. SSL works ^^
Diffstat (limited to 'src')
-rw-r--r--src/objective-c/GRPCClient/private/GRPCSecureChannel.m6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m
index 5ed788347c..f5b132e99a 100644
--- a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m
+++ b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m
@@ -64,7 +64,11 @@ static const char *kCertificates =
- (instancetype)initWithHost:(NSString *)host {
// TODO(jcanizales): Get the certificates here.
- grpc_credentials *credentials = grpc_ssl_credentials_create(kCertificates, NULL);
+ NSURL *url = [[NSBundle mainBundle] URLForResource:@"gRPC.bundle/roots" withExtension:@"pem"];
+ NSData *fontData = [NSData dataWithContentsOfURL:url];
+ NSString *str = [[NSString alloc] initWithData:fontData encoding:NSUTF8StringEncoding];
+ NSLog(@"Certs:\n%@", str);
+ grpc_credentials *credentials = grpc_ssl_credentials_create(str.UTF8String, NULL);
return (self = [super initWithChannel:grpc_secure_channel_create(credentials,
host.UTF8String,
NULL)]);