Skip to content

Commit 9c44754

Browse files
committed
Remove usage of AdvancedTls.
1 parent c7d3873 commit 9c44754

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

s2a/src/main/java/io/grpc/s2a/MtlsToS2AChannelCredentials.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@
2323
import io.grpc.ChannelCredentials;
2424
import io.grpc.ExperimentalApi;
2525
import io.grpc.TlsChannelCredentials;
26-
import io.grpc.util.AdvancedTlsX509KeyManager;
27-
import io.grpc.util.AdvancedTlsX509TrustManager;
2826
import java.io.File;
2927
import 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

Comments
 (0)