Skip to content
Permalink
Browse files

8243029: Rewrite javax/net/ssl/compatibility/Compatibility.java with …

…a flexible interop test framework

Reviewed-by: xuelei
  • Loading branch information
John Jiang
John Jiang committed Apr 24, 2020
1 parent e5c84ff commit 2a4596cfe4d37b356092304c672c3d29b57056c8
Showing with 4,293 additions and 1,814 deletions.
  1. +64 −0 test/jdk/javax/net/ssl/TLSCommon/Cert.java
  2. +2 −2 test/jdk/javax/net/ssl/TLSCommon/CipherSuite.java
  3. +39 −0 test/jdk/javax/net/ssl/TLSCommon/HashAlgorithm.java
  4. +34 −0 test/jdk/javax/net/ssl/TLSCommon/KeyUpdateRequest.java
  5. +47 −0 test/jdk/javax/net/ssl/TLSCommon/NamedGroup.java
  6. +31 −0 test/jdk/javax/net/ssl/TLSCommon/ResumptionMode.java
  7. +39 −0 test/jdk/javax/net/ssl/TLSCommon/SignatureAlgorithm.java
  8. +54 −0 test/jdk/javax/net/ssl/TLSCommon/interop/AbstractClient.java
  9. +213 −0 test/jdk/javax/net/ssl/TLSCommon/interop/AbstractPeer.java
  10. +65 −0 test/jdk/javax/net/ssl/TLSCommon/interop/AbstractProduct.java
  11. +80 −0 test/jdk/javax/net/ssl/TLSCommon/interop/AbstractServer.java
  12. +336 −0 test/jdk/javax/net/ssl/TLSCommon/interop/BaseInteropTest.java
  13. +51 −0 test/jdk/javax/net/ssl/TLSCommon/interop/CertTuple.java
  14. +35 −0 test/jdk/javax/net/ssl/TLSCommon/interop/Client.java
  15. +37 −0 test/jdk/javax/net/ssl/TLSCommon/interop/ConnectionInterceptor.java
  16. +59 −0 test/jdk/javax/net/ssl/TLSCommon/interop/ExtInteropTest.java
  17. +99 −0 test/jdk/javax/net/ssl/TLSCommon/interop/ExtUseCase.java
  18. +57 −0 test/jdk/javax/net/ssl/TLSCommon/interop/Jdk.java
  19. +158 −0 test/jdk/javax/net/ssl/TLSCommon/interop/JdkClient.java
  20. +103 −0 test/jdk/javax/net/ssl/TLSCommon/interop/JdkHttpsClient.java
  21. +186 −0 test/jdk/javax/net/ssl/TLSCommon/interop/JdkProcClient.java
  22. +225 −0 test/jdk/javax/net/ssl/TLSCommon/interop/JdkProcServer.java
  23. +137 −0 test/jdk/javax/net/ssl/TLSCommon/interop/JdkProcUtils.java
  24. +149 −0 test/jdk/javax/net/ssl/TLSCommon/interop/JdkServer.java
  25. +54 −0 test/jdk/javax/net/ssl/TLSCommon/interop/JdkUtils.java
  26. +51 −0 test/jdk/javax/net/ssl/TLSCommon/interop/KeyUpdateUseCase.java
  27. +52 −0 test/jdk/javax/net/ssl/TLSCommon/interop/Peer.java
  28. +24 −14 test/jdk/javax/net/ssl/{compatibility/ProcessUtils.java → TLSCommon/interop/ProcUtils.java}
  29. +33 −0 test/jdk/javax/net/ssl/TLSCommon/interop/Product.java
  30. +83 −0 test/jdk/javax/net/ssl/TLSCommon/interop/ResumptionUseCase.java
  31. +40 −0 test/jdk/javax/net/ssl/TLSCommon/interop/SSLTestException.java
  32. +51 −0 test/jdk/javax/net/ssl/TLSCommon/interop/Server.java
  33. +5 −3 test/jdk/javax/net/ssl/{compatibility → TLSCommon/interop}/Status.java
  34. +112 −0 test/jdk/javax/net/ssl/TLSCommon/interop/TestCase.java
  35. +136 −0 test/jdk/javax/net/ssl/TLSCommon/interop/UseCase.java
  36. +511 −0 test/jdk/javax/net/ssl/TLSCommon/interop/Utilities.java
  37. +181 −0 test/jdk/javax/net/ssl/compatibility/AlpnTest.java
  38. +180 −0 test/jdk/javax/net/ssl/compatibility/BasicConnectTest.java
  39. +0 −421 test/jdk/javax/net/ssl/compatibility/Cert.java
  40. +0 −206 test/jdk/javax/net/ssl/compatibility/Client.java
  41. +0 −341 test/jdk/javax/net/ssl/compatibility/Compatibility.java
  42. +163 −0 test/jdk/javax/net/ssl/compatibility/HrrTest.java
  43. +12 −10 test/jdk/javax/net/ssl/compatibility/JdkInfo.java
  44. +7 −7 test/jdk/javax/net/ssl/compatibility/{JdkUtils.java → JdkInfoUtils.java}
  45. +12 −80 test/jdk/javax/net/ssl/compatibility/README
  46. +0 −162 test/jdk/javax/net/ssl/compatibility/Server.java
  47. +181 −0 test/jdk/javax/net/ssl/compatibility/SniTest.java
  48. +0 −121 test/jdk/javax/net/ssl/compatibility/TestCase.java
  49. +0 −206 test/jdk/javax/net/ssl/compatibility/UseCase.java
  50. +71 −240 test/jdk/javax/net/ssl/compatibility/Utils.java
  51. +34 −1 test/lib/jdk/test/lib/security/CertUtils.java
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*
* The certificates and corresponding private keys.
*/
public class Cert {

public final KeyAlgorithm keyAlgo;
public final SignatureAlgorithm sigAlgo;
public final HashAlgorithm hashAlgo;

public final String certMaterials;
public final String keyMaterials;

public Cert(
KeyAlgorithm keyAlgo,
SignatureAlgorithm sigAlgo,
HashAlgorithm hashAlgo,
String certMaterials,
String keyMaterials) {
this.keyAlgo = keyAlgo;
this.sigAlgo = sigAlgo;
this.hashAlgo = hashAlgo;

this.certMaterials = certMaterials;
this.keyMaterials = keyMaterials;
}

public Cert(
KeyAlgorithm keyAlgo,
SignatureAlgorithm sigAlgo,
HashAlgorithm hashAlgo,
String certMaterials) {
this(keyAlgo, sigAlgo, hashAlgo, certMaterials, null);
}

@Override
public String toString() {
return "keyAlgo=" + keyAlgo
+ ",sigAlgo=" + sigAlgo
+ ",hashAlg=" + hashAlgo;
}
}
@@ -161,15 +161,15 @@
TLS_DHE_RSA_WITH_AES_256_CBC_SHA(
0x0039, KeyExAlgorithm.DHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_DHE_DSS_WITH_AES_256_CBC_SHA(
0x0038, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2),
0x0038, KeyExAlgorithm.DHE_DSS, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_RSA_WITH_AES_256_CBC_SHA(
0x0035, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_DH_anon_WITH_AES_128_CBC_SHA(
0x0034, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_DHE_RSA_WITH_AES_128_CBC_SHA(
0x0033, KeyExAlgorithm.DHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_DHE_DSS_WITH_AES_128_CBC_SHA(
0x0032, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2),
0x0032, KeyExAlgorithm.DHE_DSS, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_RSA_WITH_AES_128_CBC_SHA(
0x002F, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_KRB5_WITH_3DES_EDE_CBC_MD5(
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*
* Hash algorithms.
*/
public enum HashAlgorithm {

SHA1("SHA-1"),
SHA256("SHA-256"),
SHA384("SHA-384"),
SHA512("SHA-512");

public final String name;

private HashAlgorithm(String name) {
this.name = name;
}
}
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

public enum KeyUpdateRequest {

NOT_REQUESTED("update_not_requested"),
REQUESTED("update_requested");

public String name;

KeyUpdateRequest(String name) {
this.name = name;
}
}
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*
* Named groups.
*/
public enum NamedGroup {

SECP256R1("secp256r1"),
SECP384R1("secp384r1"),
SECP521R1("secp521r1"),

X448("x448"),
X25519("x25519"),

FFDHE2048("ffdhe2048"),
FFDHE3072("ffdhe3072"),
FFDHE4096("ffdhe4096"),
FFDHE6144("ffdhe6144"),
FFDHE8192("ffdhe8192");

public final String name;

private NamedGroup(String name) {
this.name = name;
}
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*
* The session resumption modes.
*/
public enum ResumptionMode {

ID, // Resumed via session id
TICKET, // Resumed via session ticket
}
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*
* Signature algorithms.
*/
public enum SignatureAlgorithm {

RSA("RSA"),
DSA("DSA"),
ECDSA("ECDSA"),
RSASSAPSS("RSASSA-PSS");

public final String name;

private SignatureAlgorithm(String name) {
this.name = name;
}
}
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

import java.io.IOException;

/*
* An abstract client.
*/
public abstract class AbstractClient extends AbstractPeer implements Client {

@Override
protected void printLog() throws IOException {
System.out.println("---------- Client log start ----------");
super.printLog();
System.out.println("---------- Client log end ----------");
}

public static abstract class Builder extends AbstractPeer.Builder {

// Indicate if try to read response.
private boolean readResponse = true;

public boolean isReadResponse() {
return readResponse;
}

public Builder setReadResponse(boolean readResponse) {
this.readResponse = readResponse;
return this;
}

public abstract AbstractClient build() throws Exception;
}
}

0 comments on commit 2a4596c

Please sign in to comment.
You can’t perform that action at this time.