Skip to content

util: Align AdvancedTlsX509{Key and Trust}Manager #11385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Style fix
  • Loading branch information
erm-g committed Jul 16, 2024
commit f289c906d77bb110efed575d119edce4453dbd06
14 changes: 7 additions & 7 deletions netty/src/test/java/io/grpc/netty/AdvancedTlsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ public void onFileReloadingKeyManagerTrustManagerTest() throws Exception {
AdvancedTlsX509TrustManager serverTrustManager = AdvancedTlsX509TrustManager.newBuilder()
.setVerification(Verification.CERTIFICATE_ONLY_VERIFICATION)
.build();
Closeable serverTrustShutdown = serverTrustManager.updateTrustCredentials(caCertFile,100,
TimeUnit.MILLISECONDS, executor);
Closeable serverTrustShutdown = serverTrustManager.updateTrustCredentials(caCertFile,
100, TimeUnit.MILLISECONDS, executor);
ServerCredentials serverCredentials = TlsServerCredentials.newBuilder()
.keyManager(serverKeyManager).trustManager(serverTrustManager)
.clientAuth(ClientAuth.REQUIRE).build();
Expand All @@ -349,12 +349,12 @@ public void onFileReloadingKeyManagerTrustManagerTest() throws Exception {
// Create a client to connect.
AdvancedTlsX509KeyManager clientKeyManager = new AdvancedTlsX509KeyManager();
Closeable clientKeyShutdown = clientKeyManager.updateIdentityCredentials(clientCert0File,
clientKey0File,100, TimeUnit.MILLISECONDS, executor);
clientKey0File, 100, TimeUnit.MILLISECONDS, executor);
AdvancedTlsX509TrustManager clientTrustManager = AdvancedTlsX509TrustManager.newBuilder()
.setVerification(Verification.CERTIFICATE_AND_HOST_NAME_VERIFICATION)
.build();
Closeable clientTrustShutdown = clientTrustManager.updateTrustCredentials(caCertFile,100,
TimeUnit.MILLISECONDS, executor);
Closeable clientTrustShutdown = clientTrustManager.updateTrustCredentials(caCertFile,
100, TimeUnit.MILLISECONDS, executor);
ChannelCredentials channelCredentials = TlsChannelCredentials.newBuilder()
.keyManager(clientKeyManager).trustManager(clientTrustManager).build();
channel = Grpc.newChannelBuilderForAddress("localhost", server.getPort(), channelCredentials)
Expand Down Expand Up @@ -431,8 +431,8 @@ public void onFileReloadingTrustManagerBadInitialContentTest() throws Exception
.build();
// We pass in a key as the trust certificates to intentionally create an exception.
assertThrows(GeneralSecurityException.class,
() -> trustManager.updateTrustCredentials(serverKey0File,100,
TimeUnit.MILLISECONDS, executor));
() -> trustManager.updateTrustCredentials(serverKey0File, 100, TimeUnit.MILLISECONDS,
executor));
}

@Test
Expand Down
Loading