'How GRPC C++ trust all X.509 certificates without any verification like java?
Java can create trustmanager all certifates through method:
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, new TrustManager[] { new TrustAllCerts() }, new SecureRandom());
How to do in GRPC C++ code, i search many method to do, but failed. have any idea?
in URL How to make C++ client trust all X.509 certificates without any verification (like in Java), told grpc c++ not support this feature, and it's true? if support how to do, please give some suggestion and show code. thanks
Solution 1:[1]
With the newer TLS API something like this should work:
auto Connect(std::string address) {
::grpc::experimental::TlsChannelCredentialsOptions authOptions;
authOptions.set_verify_server_certs(false);
//authOptions.set_certificate_verifier(fancy_verifier);
return ::grpc::CreateChannel(
address,
::grpc::experimental::TlsCredentials(authOptions)
);
}
This API is experimental, that is, unstable - it varies quite a bit between gRPC library versions.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | oakad |
