Loads certificates from file. SSL works ^^

pull/1341/head
Jorge Canizales 10 years ago
parent bb58d224e7
commit 6465c34045
  1. 6
      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)]);

Loading…
Cancel
Save