|
|
@ -137,10 +137,7 @@ static NSMutableDictionary *kHostCache; |
|
|
|
completionQueue:queue]; |
|
|
|
completionQueue:queue]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (NSData *)nullTerminatedDataWithString:(NSString *_Nullable)string { |
|
|
|
- (NSData *)nullTerminatedDataWithString:(NSString *)string { |
|
|
|
if (string == nil) { |
|
|
|
|
|
|
|
return nil; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// dataUsingEncoding: does not return a null-terminated string. |
|
|
|
// dataUsingEncoding: does not return a null-terminated string. |
|
|
|
NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; |
|
|
|
NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; |
|
|
|
NSMutableData *nullTerminated = [NSMutableData dataWithData:data]; |
|
|
|
NSMutableData *nullTerminated = [NSMutableData dataWithData:data]; |
|
|
@ -196,6 +193,7 @@ static NSMutableDictionary *kHostCache; |
|
|
|
if (pemPrivateKey == nil && pemCertChain == nil) { |
|
|
|
if (pemPrivateKey == nil && pemCertChain == nil) { |
|
|
|
creds = grpc_ssl_credentials_create(rootsASCII.bytes, NULL, NULL, NULL); |
|
|
|
creds = grpc_ssl_credentials_create(rootsASCII.bytes, NULL, NULL, NULL); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
assert(pemPrivateKey != nil && pemCertChain != nil); |
|
|
|
grpc_ssl_pem_key_cert_pair key_cert_pair; |
|
|
|
grpc_ssl_pem_key_cert_pair key_cert_pair; |
|
|
|
NSData *privateKeyASCII = [self nullTerminatedDataWithString:pemPrivateKey]; |
|
|
|
NSData *privateKeyASCII = [self nullTerminatedDataWithString:pemPrivateKey]; |
|
|
|
NSData *certChainASCII = [self nullTerminatedDataWithString:pemCertChain]; |
|
|
|
NSData *certChainASCII = [self nullTerminatedDataWithString:pemCertChain]; |
|
|
|