diff options
author | Brian Carlstrom <bdc@google.com> | 2014-06-17 10:42:21 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2014-07-07 11:27:08 -0700 |
commit | 8d290a506a4a1cd1f86716719ee10586700468f4 (patch) | |
tree | dc9fa9a49c8e42cd85a6c0d691ac910610281410 /support | |
parent | ed3ee85f37dbe2fc4517cc296dd4a59edac558bc (diff) | |
download | libcore-8d290a506a4a1cd1f86716719ee10586700468f4.zip libcore-8d290a506a4a1cd1f86716719ee10586700468f4.tar.gz libcore-8d290a506a4a1cd1f86716719ee10586700468f4.tar.bz2 |
Remove
(cherry picked from commit 36214feb86a0963b23f34c8c63584252bd757e19)
Change-Id: I96d5109c01e39255b9970f7a515ddd3575a50e56
Diffstat (limited to 'support')
-rw-r--r-- | support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java | 13 | ||||
-rw-r--r-- | support/src/test/java/libcore/javax/net/ssl/TestTrustManager.java | 105 |
2 files changed, 9 insertions, 109 deletions
diff --git a/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java b/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java index 5741f2b..8dd2085 100644 --- a/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java +++ b/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java @@ -33,7 +33,6 @@ import javax.net.ssl.SSLServerSocket; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; -import javax.net.ssl.X509ExtendedTrustManager; import javax.net.ssl.X509TrustManager; import junit.framework.Assert; import libcore.java.security.StandardNames; @@ -83,8 +82,8 @@ public final class TestSSLContext extends Assert { public final char[] serverStorePassword; public final KeyManager[] clientKeyManagers; public final KeyManager[] serverKeyManagers; - public final X509ExtendedTrustManager clientTrustManager; - public final X509ExtendedTrustManager serverTrustManager; + public final X509TrustManager clientTrustManager; + public final X509TrustManager serverTrustManager; public final SSLContext clientContext; public final SSLContext serverContext; public final SSLServerSocket serverSocket; @@ -97,8 +96,8 @@ public final class TestSSLContext extends Assert { char[] serverStorePassword, KeyManager[] clientKeyManagers, KeyManager[] serverKeyManagers, - X509ExtendedTrustManager clientTrustManager, - X509ExtendedTrustManager serverTrustManager, + X509TrustManager clientTrustManager, + X509TrustManager serverTrustManager, SSLContext clientContext, SSLContext serverContext, SSLServerSocket serverSocket, @@ -189,8 +188,8 @@ public final class TestSSLContext extends Assert { serverKeyStore, serverStorePassword, clientKeyManagers, serverKeyManagers, - (X509ExtendedTrustManager) clientTrustManagers, - (X509ExtendedTrustManager) serverTrustManagers, + (X509TrustManager) clientTrustManagers, + (X509TrustManager) serverTrustManagers, clientContext, serverContext, serverSocket, host, port); } catch (RuntimeException e) { diff --git a/support/src/test/java/libcore/javax/net/ssl/TestTrustManager.java b/support/src/test/java/libcore/javax/net/ssl/TestTrustManager.java index b703984..dc4bb28 100644 --- a/support/src/test/java/libcore/javax/net/ssl/TestTrustManager.java +++ b/support/src/test/java/libcore/javax/net/ssl/TestTrustManager.java @@ -20,7 +20,6 @@ import java.io.PrintStream; import java.net.Socket; import javax.net.ssl.SSLEngine; import javax.net.ssl.TrustManager; -import javax.net.ssl.X509ExtendedTrustManager; import javax.net.ssl.X509TrustManager; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; @@ -29,16 +28,15 @@ import libcore.java.security.StandardNames; /** * TestTrustManager is a simple proxy class that wraps an existing - * X509ExtendedTrustManager to provide debug logging and recording of + * X509TrustManager to provide debug logging and recording of * values. */ -public final class TestTrustManager extends X509ExtendedTrustManager { +public final class TestTrustManager implements X509TrustManager { private static final boolean LOG = false; private static final PrintStream out = LOG ? System.out : new NullPrintStream(); private final X509TrustManager trustManager; - private final X509ExtendedTrustManager extendedTrustManager; public static TrustManager[] wrap(TrustManager[] trustManagers) { TrustManager[] result = trustManagers.clone(); @@ -49,23 +47,14 @@ public final class TestTrustManager extends X509ExtendedTrustManager { } public static TrustManager wrap(TrustManager trustManager) { - if (trustManager instanceof X509ExtendedTrustManager) { - return new TestTrustManager((X509ExtendedTrustManager) trustManager); - } else if (trustManager instanceof X509TrustManager) { + if (trustManager instanceof X509TrustManager) { return new TestTrustManager((X509TrustManager) trustManager); } return trustManager; } - public TestTrustManager(X509ExtendedTrustManager trustManager) { - out.println("TestTrustManager.<init> extendedTrustManager=" + trustManager); - this.extendedTrustManager = trustManager; - this.trustManager = trustManager; - } - public TestTrustManager(X509TrustManager trustManager) { out.println("TestTrustManager.<init> trustManager=" + trustManager); - this.extendedTrustManager = null; this.trustManager = trustManager; } @@ -84,50 +73,6 @@ public final class TestTrustManager extends X509ExtendedTrustManager { } } - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) - throws CertificateException { - if (extendedTrustManager == null) { - out.print("(fallback to X509TrustManager) "); - checkClientTrusted(chain, authType); - return; - } - out.print("TestTrustManager.checkClientTrusted " - + "chain=" + chain.length + " " - + "authType=" + authType + " " - + "socket=" + socket + " "); - try { - assertClientAuthType(authType); - extendedTrustManager.checkClientTrusted(chain, authType, socket); - out.println("OK"); - } catch (CertificateException e) { - e.printStackTrace(out); - throw e; - } - } - - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType, SSLEngine engine) - throws CertificateException { - if (extendedTrustManager == null) { - out.print("(fallback to X509TrustManager) "); - checkClientTrusted(chain, authType); - return; - } - out.print("TestTrustManager.checkClientTrusted " - + "chain=" + chain.length + " " - + "authType=" + authType + " " - + "engine=" + engine + " "); - try { - assertClientAuthType(authType); - extendedTrustManager.checkClientTrusted(chain, authType, engine); - out.println("OK"); - } catch (CertificateException e) { - e.printStackTrace(out); - throw e; - } - } - private void assertClientAuthType(String authType) { if (!StandardNames.CLIENT_AUTH_TYPES.contains(authType)) { throw new AssertionError("Unexpected client auth type " + authType); @@ -149,50 +94,6 @@ public final class TestTrustManager extends X509ExtendedTrustManager { } } - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType, Socket socket) - throws CertificateException { - if (extendedTrustManager == null) { - out.print("(fallback to X509TrustManager) "); - checkServerTrusted(chain, authType); - return; - } - out.print("TestTrustManager.checkServerTrusted " - + "chain=" + chain.length + " " - + "authType=" + authType + " " - + "socket=" + socket.toString() + " "); - try { - assertServerAuthType(authType); - extendedTrustManager.checkServerTrusted(chain, authType, socket); - out.println("OK"); - } catch (CertificateException e) { - e.printStackTrace(out); - throw e; - } - } - - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) - throws CertificateException { - if (extendedTrustManager == null) { - out.print("(fallback to X509TrustManager) "); - checkServerTrusted(chain, authType); - return; - } - out.print("TestTrustManager.checkServerTrusted " - + "chain=" + chain.length + " " - + "authType=" + authType + " " - + "engine=" + engine.toString() + " "); - try { - assertServerAuthType(authType); - extendedTrustManager.checkServerTrusted(chain, authType, engine); - out.println("OK"); - } catch (CertificateException e) { - e.printStackTrace(out); - throw e; - } - } - private void assertServerAuthType(String authType) { if (!StandardNames.SERVER_AUTH_TYPES.contains(authType)) { throw new AssertionError("Unexpected server auth type " + authType); |