summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rw-r--r--support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java13
-rw-r--r--support/src/test/java/libcore/javax/net/ssl/TestTrustManager.java105
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);