2323import io .grpc .ChannelCredentials ;
2424import io .grpc .ExperimentalApi ;
2525import io .grpc .TlsChannelCredentials ;
26- import io .grpc .util .AdvancedTlsX509KeyManager ;
27- import io .grpc .util .AdvancedTlsX509TrustManager ;
2826import java .io .File ;
2927import java .io .IOException ;
30- import java .security .GeneralSecurityException ;
3128
3229/**
3330 * Configures an {@code S2AChannelCredentials.Builder} instance with credentials used to establish a
@@ -68,7 +65,7 @@ public static final class Builder {
6865 this .trustBundlePath = trustBundlePath ;
6966 }
7067
71- public S2AChannelCredentials .Builder build () throws GeneralSecurityException , IOException {
68+ public S2AChannelCredentials .Builder build () throws IOException {
7269 checkState (!isNullOrEmpty (s2aAddress ), "S2A address must not be null or empty." );
7370 checkState (!isNullOrEmpty (privateKeyPath ), "privateKeyPath must not be null or empty." );
7471 checkState (!isNullOrEmpty (certChainPath ), "certChainPath must not be null or empty." );
@@ -77,16 +74,10 @@ public S2AChannelCredentials.Builder build() throws GeneralSecurityException, IO
7774 File certChainFile = new File (certChainPath );
7875 File trustBundleFile = new File (trustBundlePath );
7976
80- AdvancedTlsX509KeyManager keyManager = new AdvancedTlsX509KeyManager ();
81- keyManager .updateIdentityCredentials (certChainFile , privateKeyFile );
82-
83- AdvancedTlsX509TrustManager trustManager = AdvancedTlsX509TrustManager .newBuilder ().build ();
84- trustManager .updateTrustCredentials (trustBundleFile );
85-
8677 ChannelCredentials channelToS2ACredentials =
8778 TlsChannelCredentials .newBuilder ()
88- .keyManager (keyManager )
89- .trustManager (trustManager )
79+ .keyManager (certChainFile , privateKeyFile )
80+ .trustManager (trustBundleFile )
9081 .build ();
9182
9283 return S2AChannelCredentials .newBuilder (s2aAddress )
0 commit comments