@ -18,7 +18,6 @@
# include <memory>
# include <memory>
# include <string>
# include <string>
# include <utility>
# include <grpc/grpc_crl_provider.h>
# include <grpc/grpc_crl_provider.h>
# include <grpc/grpc_security.h>
# include <grpc/grpc_security.h>
@ -36,9 +35,13 @@ TlsCredentialsOptions::TlsCredentialsOptions() {
c_credentials_options_ = grpc_tls_credentials_options_create ( ) ;
c_credentials_options_ = grpc_tls_credentials_options_create ( ) ;
}
}
TlsCredentialsOptions : : ~ TlsCredentialsOptions ( ) {
grpc_tls_credentials_options_destroy ( c_credentials_options_ ) ;
}
void TlsCredentialsOptions : : set_certificate_provider (
void TlsCredentialsOptions : : set_certificate_provider (
std : : shared_ptr < CertificateProviderInterface > certificate_provider ) {
std : : shared_ptr < CertificateProviderInterface > certificate_provider ) {
certificate_provider_ = std : : move ( certificate_provider ) ;
certificate_provider_ = certificate_provider ;
if ( certificate_provider_ ! = nullptr ) {
if ( certificate_provider_ ! = nullptr ) {
grpc_tls_credentials_options_set_certificate_provider (
grpc_tls_credentials_options_set_certificate_provider (
c_credentials_options_ , certificate_provider_ - > c_provider ( ) ) ;
c_credentials_options_ , certificate_provider_ - > c_provider ( ) ) ;
@ -48,7 +51,7 @@ void TlsCredentialsOptions::set_certificate_provider(
void TlsCredentialsOptions : : set_crl_provider (
void TlsCredentialsOptions : : set_crl_provider (
std : : shared_ptr < CrlProvider > crl_provider ) {
std : : shared_ptr < CrlProvider > crl_provider ) {
grpc_tls_credentials_options_set_crl_provider ( c_credentials_options_ ,
grpc_tls_credentials_options_set_crl_provider ( c_credentials_options_ ,
std : : move ( crl_provider ) ) ;
crl_provider ) ;
}
}
void TlsCredentialsOptions : : watch_root_certs ( ) {
void TlsCredentialsOptions : : watch_root_certs ( ) {
@ -85,22 +88,27 @@ void TlsCredentialsOptions::set_tls_session_key_log_file_path(
void TlsCredentialsOptions : : set_certificate_verifier (
void TlsCredentialsOptions : : set_certificate_verifier (
std : : shared_ptr < CertificateVerifier > certificate_verifier ) {
std : : shared_ptr < CertificateVerifier > certificate_verifier ) {
certificate_verifier_ = std : : move ( certificate_verifier ) ;
certificate_verifier_ = certificate_verifier ;
if ( certificate_verifier_ ! = nullptr ) {
if ( certificate_verifier_ ! = nullptr ) {
grpc_tls_credentials_options_set_certificate_verifier (
grpc_tls_credentials_options_set_certificate_verifier (
c_credentials_options_ , certificate_verifier_ - > c_verifier ( ) ) ;
c_credentials_options_ , certificate_verifier_ - > c_verifier ( ) ) ;
}
}
}
}
grpc_tls_credentials_options * TlsCredentialsOptions : : c_credentials_options ( )
const {
return grpc_tls_credentials_options_copy ( c_credentials_options_ ) ;
}
void TlsCredentialsOptions : : set_check_call_host ( bool check_call_host ) {
void TlsCredentialsOptions : : set_check_call_host ( bool check_call_host ) {
grpc_tls_credentials_options * options = c_credentials_options ( ) ;
grpc_tls_credentials_options * options = mutable_ c_credentials_options( ) ;
GPR_ASSERT ( options ! = nullptr ) ;
GPR_ASSERT ( options ! = nullptr ) ;
grpc_tls_credentials_options_set_check_call_host ( options , check_call_host ) ;
grpc_tls_credentials_options_set_check_call_host ( options , check_call_host ) ;
}
}
void TlsChannelCredentialsOptions : : set_verify_server_certs (
void TlsChannelCredentialsOptions : : set_verify_server_certs (
bool verify_server_certs ) {
bool verify_server_certs ) {
grpc_tls_credentials_options * options = c_credentials_options ( ) ;
grpc_tls_credentials_options * options = mutable_ c_credentials_options( ) ;
GPR_ASSERT ( options ! = nullptr ) ;
GPR_ASSERT ( options ! = nullptr ) ;
grpc_tls_credentials_options_set_verify_server_cert ( options ,
grpc_tls_credentials_options_set_verify_server_cert ( options ,
verify_server_certs ) ;
verify_server_certs ) ;
@ -108,7 +116,7 @@ void TlsChannelCredentialsOptions::set_verify_server_certs(
void TlsServerCredentialsOptions : : set_cert_request_type (
void TlsServerCredentialsOptions : : set_cert_request_type (
grpc_ssl_client_certificate_request_type cert_request_type ) {
grpc_ssl_client_certificate_request_type cert_request_type ) {
grpc_tls_credentials_options * options = c_credentials_options ( ) ;
grpc_tls_credentials_options * options = mutable_ c_credentials_options( ) ;
GPR_ASSERT ( options ! = nullptr ) ;
GPR_ASSERT ( options ! = nullptr ) ;
grpc_tls_credentials_options_set_cert_request_type ( options ,
grpc_tls_credentials_options_set_cert_request_type ( options ,
cert_request_type ) ;
cert_request_type ) ;
@ -116,7 +124,7 @@ void TlsServerCredentialsOptions::set_cert_request_type(
void TlsServerCredentialsOptions : : set_send_client_ca_list (
void TlsServerCredentialsOptions : : set_send_client_ca_list (
bool send_client_ca_list ) {
bool send_client_ca_list ) {
grpc_tls_credentials_options * options = c_credentials_options ( ) ;
grpc_tls_credentials_options * options = mutable_ c_credentials_options( ) ;
GPR_ASSERT ( options ! = nullptr ) ;
GPR_ASSERT ( options ! = nullptr ) ;
grpc_tls_credentials_options_set_send_client_ca_list ( options ,
grpc_tls_credentials_options_set_send_client_ca_list ( options ,
send_client_ca_list ) ;
send_client_ca_list ) ;