Search in sources :

Example 11 with AdvancedTlsX509TrustManager

use of io.grpc.util.AdvancedTlsX509TrustManager in project grpc-java by grpc.

the class AdvancedTlsTest method trustManagerEmptyChainTest.

@Test
public void trustManagerEmptyChainTest() throws Exception {
    exceptionRule.expect(IllegalArgumentException.class);
    exceptionRule.expectMessage("Want certificate verification but got null or empty certificates");
    AdvancedTlsX509TrustManager tm = AdvancedTlsX509TrustManager.newBuilder().setVerification(Verification.CERTIFICATE_ONLY_VERIFICATION).build();
    tm.updateTrustCredentials(caCert);
    tm.checkClientTrusted(null, "RSA", (SSLEngine) null);
}
Also used : AdvancedTlsX509TrustManager(io.grpc.util.AdvancedTlsX509TrustManager) Test(org.junit.Test)

Aggregations

AdvancedTlsX509TrustManager (io.grpc.util.AdvancedTlsX509TrustManager)11 Test (org.junit.Test)11 ChannelCredentials (io.grpc.ChannelCredentials)5 ServerCredentials (io.grpc.ServerCredentials)5 StatusRuntimeException (io.grpc.StatusRuntimeException)5 TlsChannelCredentials (io.grpc.TlsChannelCredentials)5 TlsServerCredentials (io.grpc.TlsServerCredentials)5 SimpleServiceGrpc (io.grpc.testing.protobuf.SimpleServiceGrpc)5 AdvancedTlsX509KeyManager (io.grpc.util.AdvancedTlsX509KeyManager)5 Socket (java.net.Socket)4 SslSocketAndEnginePeerVerifier (io.grpc.util.AdvancedTlsX509TrustManager.SslSocketAndEnginePeerVerifier)3 SSLEngine (javax.net.ssl.SSLEngine)3 Closeable (java.io.Closeable)2 CertificateException (java.security.cert.CertificateException)2 X509Certificate (java.security.cert.X509Certificate)1