mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-02 03:00:35 +00:00
8326705: Test CertMsgCheck.java fails to find alert certificate_required
Reviewed-by: rhalade Backport-of: 4ffc5e60776353b03e9a557c39148e378b1690e2
This commit is contained in:
parent
d7b9454205
commit
98fd657cfa
@ -616,7 +616,6 @@ com/sun/security/sasl/gsskerb/ConfSecurityLayer.java 8039280 generic-
|
||||
com/sun/security/sasl/gsskerb/NoSecurityLayer.java 8039280 generic-all
|
||||
sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all
|
||||
sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all
|
||||
javax/net/ssl/SSLSession/CertMsgCheck.java 8326705 generic-all
|
||||
|
||||
sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8316183,8333317 generic-all
|
||||
|
||||
|
||||
@ -40,20 +40,25 @@ public class CertMsgCheck {
|
||||
|
||||
// Initial client session
|
||||
TLSBase.Client client1 = new TLSBase.Client(true, false);
|
||||
if (server.getSession(client1).getSessionContext() == null) {
|
||||
for (Exception e : server.getExceptionList()) {
|
||||
System.out.println("Looking at " + e.getClass() + " " +
|
||||
e.getMessage());
|
||||
if (e.getMessage().contains(args[0])) {
|
||||
System.out.println("Found correct exception: " + args[0] +
|
||||
" in " + e.getMessage());
|
||||
return;
|
||||
} else {
|
||||
System.out.println("No \"" + args[0] + "\" found.");
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception("Failed to find expected alert: " + args[0]);
|
||||
server.getSession(client1).getSessionContext();
|
||||
server.done();
|
||||
|
||||
var eList = server.getExceptionList();
|
||||
System.out.println("Exception list size is " + eList.size());
|
||||
|
||||
for (Exception e : eList) {
|
||||
System.out.println("Looking at " + e.getClass() + " " +
|
||||
e.getMessage());
|
||||
if (e.getMessage().contains(args[0])) {
|
||||
System.out.println("Found correct exception: " + args[0] +
|
||||
" in " + e.getMessage());
|
||||
return;
|
||||
} else {
|
||||
System.out.println("No \"" + args[0] + "\" found.");
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception("Failed to find expected alert: " + args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,8 +97,8 @@ abstract public class TLSBase {
|
||||
private static KeyManager[] getKeyManager(boolean empty) throws Exception {
|
||||
FileInputStream fis = null;
|
||||
if (!empty) {
|
||||
fis = new FileInputStream(System.getProperty("test.src", "./") + "/" + pathToStores +
|
||||
"/" + keyStoreFile);
|
||||
fis = new FileInputStream(System.getProperty("test.src", "./") +
|
||||
"/" + pathToStores + "/" + keyStoreFile);
|
||||
}
|
||||
// Load the keystore
|
||||
char[] pwd = passwd.toCharArray();
|
||||
@ -113,8 +113,8 @@ abstract public class TLSBase {
|
||||
private static TrustManager[] getTrustManager(boolean empty) throws Exception {
|
||||
FileInputStream fis = null;
|
||||
if (!empty) {
|
||||
fis = new FileInputStream(System.getProperty("test.src", "./") + "/" + pathToStores +
|
||||
"/" + trustStoreFile);
|
||||
fis = new FileInputStream(System.getProperty("test.src", "./") +
|
||||
"/" + pathToStores + "/" + trustStoreFile);
|
||||
}
|
||||
// Load the keystore
|
||||
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
@ -148,7 +148,6 @@ abstract public class TLSBase {
|
||||
// Clients sockets are kept in a hash table with the port as the key.
|
||||
ConcurrentHashMap<Integer, SSLSocket> clientMap =
|
||||
new ConcurrentHashMap<>();
|
||||
boolean exit = false;
|
||||
Thread t;
|
||||
List<Exception> exceptionList = new ArrayList<>();
|
||||
|
||||
@ -157,13 +156,14 @@ abstract public class TLSBase {
|
||||
name = "server";
|
||||
try {
|
||||
sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(TLSBase.getKeyManager(builder.km), TLSBase.getTrustManager(builder.tm), null);
|
||||
sslContext.init(TLSBase.getKeyManager(builder.km),
|
||||
TLSBase.getTrustManager(builder.tm), null);
|
||||
fac = sslContext.getServerSocketFactory();
|
||||
ssock = (SSLServerSocket) fac.createServerSocket(0);
|
||||
ssock.setNeedClientAuth(builder.clientauth);
|
||||
serverPort = ssock.getLocalPort();
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
System.err.println("Failure during server initialization");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -178,6 +178,7 @@ abstract public class TLSBase {
|
||||
try {
|
||||
write(c, read(c));
|
||||
} catch (Exception e) {
|
||||
System.out.println("Caught " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
exceptionList.add(e);
|
||||
}
|
||||
@ -203,13 +204,14 @@ abstract public class TLSBase {
|
||||
name = "server";
|
||||
try {
|
||||
sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(TLSBase.getKeyManager(km), TLSBase.getTrustManager(tm), null);
|
||||
sslContext.init(TLSBase.getKeyManager(km),
|
||||
TLSBase.getTrustManager(tm), null);
|
||||
fac = sslContext.getServerSocketFactory();
|
||||
ssock = (SSLServerSocket) fac.createServerSocket(0);
|
||||
ssock.setNeedClientAuth(true);
|
||||
serverPort = ssock.getLocalPort();
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
System.err.println("Failure during server initialization");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -224,7 +226,9 @@ abstract public class TLSBase {
|
||||
try {
|
||||
write(c, read(c));
|
||||
} catch (Exception e) {
|
||||
System.out.println("Caught " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
exceptionList.add(e);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@ -239,7 +243,7 @@ abstract public class TLSBase {
|
||||
// test or the test will never end.
|
||||
void done() {
|
||||
try {
|
||||
t.interrupt();
|
||||
t.join(5000);
|
||||
ssock.close();
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user