Skip to content

Commit 2a4596c

Browse files
author
John Jiang
committed
8243029: Rewrite javax/net/ssl/compatibility/Compatibility.java with a flexible interop test framework
Reviewed-by: xuelei
1 parent e5c84ff commit 2a4596c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4293
-1814
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* The certificates and corresponding private keys.
26+
*/
27+
public class Cert {
28+
29+
public final KeyAlgorithm keyAlgo;
30+
public final SignatureAlgorithm sigAlgo;
31+
public final HashAlgorithm hashAlgo;
32+
33+
public final String certMaterials;
34+
public final String keyMaterials;
35+
36+
public Cert(
37+
KeyAlgorithm keyAlgo,
38+
SignatureAlgorithm sigAlgo,
39+
HashAlgorithm hashAlgo,
40+
String certMaterials,
41+
String keyMaterials) {
42+
this.keyAlgo = keyAlgo;
43+
this.sigAlgo = sigAlgo;
44+
this.hashAlgo = hashAlgo;
45+
46+
this.certMaterials = certMaterials;
47+
this.keyMaterials = keyMaterials;
48+
}
49+
50+
public Cert(
51+
KeyAlgorithm keyAlgo,
52+
SignatureAlgorithm sigAlgo,
53+
HashAlgorithm hashAlgo,
54+
String certMaterials) {
55+
this(keyAlgo, sigAlgo, hashAlgo, certMaterials, null);
56+
}
57+
58+
@Override
59+
public String toString() {
60+
return "keyAlgo=" + keyAlgo
61+
+ ",sigAlgo=" + sigAlgo
62+
+ ",hashAlg=" + hashAlgo;
63+
}
64+
}

test/jdk/javax/net/ssl/TLSCommon/CipherSuite.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,15 @@ public enum CipherSuite {
161161
TLS_DHE_RSA_WITH_AES_256_CBC_SHA(
162162
0x0039, KeyExAlgorithm.DHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
163163
TLS_DHE_DSS_WITH_AES_256_CBC_SHA(
164-
0x0038, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2),
164+
0x0038, KeyExAlgorithm.DHE_DSS, Protocol.SSLV3, Protocol.TLSV1_2),
165165
TLS_RSA_WITH_AES_256_CBC_SHA(
166166
0x0035, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2),
167167
TLS_DH_anon_WITH_AES_128_CBC_SHA(
168168
0x0034, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
169169
TLS_DHE_RSA_WITH_AES_128_CBC_SHA(
170170
0x0033, KeyExAlgorithm.DHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
171171
TLS_DHE_DSS_WITH_AES_128_CBC_SHA(
172-
0x0032, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2),
172+
0x0032, KeyExAlgorithm.DHE_DSS, Protocol.SSLV3, Protocol.TLSV1_2),
173173
TLS_RSA_WITH_AES_128_CBC_SHA(
174174
0x002F, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2),
175175
TLS_KRB5_WITH_3DES_EDE_CBC_MD5(
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* Hash algorithms.
26+
*/
27+
public enum HashAlgorithm {
28+
29+
SHA1("SHA-1"),
30+
SHA256("SHA-256"),
31+
SHA384("SHA-384"),
32+
SHA512("SHA-512");
33+
34+
public final String name;
35+
36+
private HashAlgorithm(String name) {
37+
this.name = name;
38+
}
39+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
public enum KeyUpdateRequest {
25+
26+
NOT_REQUESTED("update_not_requested"),
27+
REQUESTED("update_requested");
28+
29+
public String name;
30+
31+
KeyUpdateRequest(String name) {
32+
this.name = name;
33+
}
34+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* Named groups.
26+
*/
27+
public enum NamedGroup {
28+
29+
SECP256R1("secp256r1"),
30+
SECP384R1("secp384r1"),
31+
SECP521R1("secp521r1"),
32+
33+
X448("x448"),
34+
X25519("x25519"),
35+
36+
FFDHE2048("ffdhe2048"),
37+
FFDHE3072("ffdhe3072"),
38+
FFDHE4096("ffdhe4096"),
39+
FFDHE6144("ffdhe6144"),
40+
FFDHE8192("ffdhe8192");
41+
42+
public final String name;
43+
44+
private NamedGroup(String name) {
45+
this.name = name;
46+
}
47+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* The session resumption modes.
26+
*/
27+
public enum ResumptionMode {
28+
29+
ID, // Resumed via session id
30+
TICKET, // Resumed via session ticket
31+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* Signature algorithms.
26+
*/
27+
public enum SignatureAlgorithm {
28+
29+
RSA("RSA"),
30+
DSA("DSA"),
31+
ECDSA("ECDSA"),
32+
RSASSAPSS("RSASSA-PSS");
33+
34+
public final String name;
35+
36+
private SignatureAlgorithm(String name) {
37+
this.name = name;
38+
}
39+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
import java.io.IOException;
25+
26+
/*
27+
* An abstract client.
28+
*/
29+
public abstract class AbstractClient extends AbstractPeer implements Client {
30+
31+
@Override
32+
protected void printLog() throws IOException {
33+
System.out.println("---------- Client log start ----------");
34+
super.printLog();
35+
System.out.println("---------- Client log end ----------");
36+
}
37+
38+
public static abstract class Builder extends AbstractPeer.Builder {
39+
40+
// Indicate if try to read response.
41+
private boolean readResponse = true;
42+
43+
public boolean isReadResponse() {
44+
return readResponse;
45+
}
46+
47+
public Builder setReadResponse(boolean readResponse) {
48+
this.readResponse = readResponse;
49+
return this;
50+
}
51+
52+
public abstract AbstractClient build() throws Exception;
53+
}
54+
}

0 commit comments

Comments
 (0)