|
|
|
@ -151,20 +151,17 @@ std::shared_ptr<grpc::ChannelCredentials> GetChannelCredentials( |
|
|
|
|
return InsecureChannelCredentials(); |
|
|
|
|
} |
|
|
|
|
args->SetSslTargetNameOverride("foo.test.google.fr"); |
|
|
|
|
// TODO(yashykt): Switch to using C++ API once b/173823806 is fixed.
|
|
|
|
|
grpc_tls_credentials_options* options = grpc_tls_credentials_options_create(); |
|
|
|
|
grpc_tls_credentials_options_set_certificate_provider( |
|
|
|
|
options, |
|
|
|
|
grpc_core::MakeRefCounted<grpc_core::StaticDataCertificateProvider>( |
|
|
|
|
ReadFile(kCaCertPath), |
|
|
|
|
ReadTlsIdentityPair(kClientKeyPath, kClientCertPath)) |
|
|
|
|
.get()); |
|
|
|
|
std::vector<experimental::IdentityKeyCertPair> identity_key_cert_pairs = { |
|
|
|
|
{ReadFile(kClientKeyPath), ReadFile(kClientCertPath)}}; |
|
|
|
|
grpc::experimental::TlsChannelCredentialsOptions options; |
|
|
|
|
options.set_certificate_provider( |
|
|
|
|
std::make_shared<grpc::experimental::StaticDataCertificateProvider>( |
|
|
|
|
ReadFile(kCaCertPath), identity_key_cert_pairs)); |
|
|
|
|
if (type == CredentialsType::kMtls) { |
|
|
|
|
grpc_tls_credentials_options_watch_identity_key_cert_pairs(options); |
|
|
|
|
options.watch_identity_key_cert_pairs(); |
|
|
|
|
} |
|
|
|
|
grpc_tls_credentials_options_watch_root_certs(options); |
|
|
|
|
return std::make_shared<SecureChannelCredentials>( |
|
|
|
|
grpc_tls_credentials_create(options)); |
|
|
|
|
options.watch_root_certs(); |
|
|
|
|
return grpc::experimental::TlsCredentials(options); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::shared_ptr<grpc::ServerCredentials> GetServerCredentials( |
|
|
|
|