Skip to content

Commit

Permalink
dtls
Browse files Browse the repository at this point in the history
  • Loading branch information
JinhangZhang committed Aug 25, 2024
1 parent f19a0af commit 24ab95d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
29 changes: 15 additions & 14 deletions test/jdk/javax/net/ssl/DTLS/CipherSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,21 @@ public static void main(String[] args) throws Exception {
cipherSuite = args[0];

CipherSuite testCase = new CipherSuite();
try {
testCase.runTest(testCase);
} catch (javax.net.ssl.SSLHandshakeException sslhe) {
if (Utils.isFIPS()
&& !SecurityUtils.TLS_CIPHERSUITES.containsKey(cipherSuite)) {
if ("No appropriate protocol (protocol is disabled or cipher suites are inappropriate)".equals(sslhe.getMessage())) {
System.out.println("Expected exception msg: <No appropriate protocol (protocol is disabled or cipher suites are inappropriate)> is caught");
return;
}
}
} catch (Exception e) {
e.printStackTrace();
return;
}
// try {
// testCase.runTest(testCase);
// } catch (javax.net.ssl.SSLHandshakeException sslhe) {
// if (Utils.isFIPS()
// && !SecurityUtils.TLS_CIPHERSUITES.containsKey(cipherSuite)) {
// if ("No appropriate protocol (protocol is disabled or cipher suites are inappropriate)".equals(sslhe.getMessage())) {
// System.out.println("Expected exception msg: <No appropriate protocol (protocol is disabled or cipher suites are inappropriate)> is caught");
// return;
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// return;
// }
testCase.runTest(testCase);
}

@Override
Expand Down
7 changes: 3 additions & 4 deletions test/jdk/javax/net/ssl/DTLS/DTLSOverDatagram.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public class DTLSOverDatagram {
private static final String KEY_STORE_FILE = "keystore";
private static final String TRUST_STORE_FILE = "truststore";

private static String KEY_FILENAME =
private static final String KEY_FILENAME =
System.getProperty("test.src", ".") + "/" + PATH_TO_STORES +
"/" + KEY_STORE_FILE;
private static String TRUST_FILENAME =
private static final String TRUST_FILENAME =
System.getProperty("test.src", ".") + "/" + PATH_TO_STORES +
"/" + TRUST_STORE_FILE;

Expand Down Expand Up @@ -506,12 +506,11 @@ boolean onReceiveTimeout(SSLEngine engine, SocketAddress socketAddr,
// get DTSL context
SSLContext getDTLSContext() throws Exception {
String passphrase = "passphrase";
String protocol = "DTLS";
return SSLContextBuilder.builder()
.trustStore(KeyStoreUtils.loadKeyStore(TRUST_FILENAME, passphrase))
.keyStore(KeyStoreUtils.loadKeyStore(KEY_FILENAME, passphrase))
.kmfPassphrase(passphrase)
.protocol(protocol)
.protocol("DTLS")
.build();
}

Expand Down
7 changes: 3 additions & 4 deletions test/jdk/javax/net/ssl/FIPSFlag/TestFIPS.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,18 @@
public class TestFIPS {

private static final String SEMERU_FIPS = System.getProperty("semeru.fips");

private static final String PROFILE = System.getProperty("semeru.customprofile");

public static void main(String[] args) throws Exception {

System.setProperty("semeru.customprofile", "OpenJCEPlusFIPS.FIPS140-3-Weakly-Enforced");
// System.setProperty("semeru.customprofile", "OpenJCEPlusFIPS.FIPS140-3-Weakly-Enforced");

for (Provider.Service service : Security.getProvider("SUN").getServices()) {
System.out.println(" Service: " + service.getType() + " Algorithm: " + service.getAlgorithm() + " Class: " + service.getClassName());
}

System.out.println("com.ibm.fips.mode: " + System.getProperty("com.ibm.fips.mode"));
System.out.println("<Customprofile> is: " + System.getProperty("semeru.customprofile"));
// System.out.println("com.ibm.fips.mode: " + System.getProperty("com.ibm.fips.mode"));
// System.out.println("<Customprofile> is: " + System.getProperty("semeru.customprofile"));

if (SEMERU_FIPS == null) {
if (args.length == 1 && args[0].equals("false")) {
Expand Down
1 change: 1 addition & 0 deletions test/jdk/javax/net/ssl/SSLSocket/ClientExcOnAlert.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class ClientExcOnAlert {
// file.
private static int serverPort = -1;
private static final String KEYSTORE_PASS = "password";
// private static final String KEYSTORE_PEM_FIPS = ;
private static final String KEYSTORE_PEM =
"MIIJrwIBAzCCCWgGCSqGSIb3DQEHAaCCCVkEgglVMIIJUTCCBW0GCSqGSIb3DQEH\n" +
"AaCCBV4EggVaMIIFVjCCBVIGCyqGSIb3DQEMCgECoIIE+zCCBPcwKQYKKoZIhvcN\n" +
Expand Down

0 comments on commit 24ab95d

Please sign in to comment.