|
|
|
@ -29,9 +29,9 @@ NS_ASSUME_NONNULL_BEGIN |
|
|
|
|
grpc_channel_credentials *_channelCreds; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
+ (nullable instancetype)factoryWithPEMRootCertificates:(nullable NSString *)rootCerts |
|
|
|
|
privateKey:(nullable NSString *)privateKey |
|
|
|
|
certChain:(nullable NSString *)certChain |
|
|
|
|
+ (instancetype _Nullable)factoryWithPEMRootCertificates:(NSString * _Nullable)rootCerts |
|
|
|
|
privateKey:(NSString * _Nullable)privateKey |
|
|
|
|
certChain:(NSString * _Nullable)certChain |
|
|
|
|
error:(NSError **)errorPtr { |
|
|
|
|
return [[self alloc] initWithPEMRootCerts:rootCerts |
|
|
|
|
privateKey:privateKey |
|
|
|
@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN |
|
|
|
|
error:errorPtr]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (NSData *)nullTerminatedDataWithString:(NSString *)string { |
|
|
|
|
- (NSData * _Nullable)nullTerminatedDataWithString:(NSString * _Nullable)string { |
|
|
|
|
// dataUsingEncoding: does not return a null-terminated string. |
|
|
|
|
NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; |
|
|
|
|
if (data == nil) { |
|
|
|
@ -50,9 +50,9 @@ NS_ASSUME_NONNULL_BEGIN |
|
|
|
|
return nullTerminated; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (nullable instancetype)initWithPEMRootCerts:(nullable NSString *)rootCerts |
|
|
|
|
privateKey:(nullable NSString *)privateKey |
|
|
|
|
certChain:(nullable NSString *)certChain |
|
|
|
|
- (instancetype _Nullable)initWithPEMRootCerts:(NSString * _Nullable)rootCerts |
|
|
|
|
privateKey:(NSString * _Nullable)privateKey |
|
|
|
|
certChain:(NSString * _Nullable)certChain |
|
|
|
|
error:(NSError **)errorPtr { |
|
|
|
|
static NSData *defaultRootsASCII; |
|
|
|
|
static NSError *defaultRootsError; |
|
|
|
@ -116,8 +116,8 @@ NS_ASSUME_NONNULL_BEGIN |
|
|
|
|
return self; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (nullable grpc_channel *)createChannelWithHost:(NSString *)host |
|
|
|
|
channelArgs:(nullable NSDictionary *)args { |
|
|
|
|
- (grpc_channel * _Nullable)createChannelWithHost:(NSString *)host |
|
|
|
|
channelArgs:(NSDictionary * _Nullable)args { |
|
|
|
|
grpc_channel_args *coreChannelArgs = GRPCBuildChannelArgs([args copy]); |
|
|
|
|
grpc_channel *unmanagedChannel = |
|
|
|
|
grpc_secure_channel_create(_channelCreds, host.UTF8String, coreChannelArgs, NULL); |
|
|
|
|