mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8365623: test/jdk/sun/security/pkcs11/tls/ tests skipped without skip exception
Reviewed-by: syan, rhalade
This commit is contained in:
parent
561c544d85
commit
da8e41a368
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, 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
|
||||
@ -35,7 +35,6 @@
|
||||
import java.io.BufferedReader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.Provider;
|
||||
import java.security.ProviderException;
|
||||
import java.util.Arrays;
|
||||
@ -45,6 +44,7 @@ import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
import sun.security.internal.spec.TlsKeyMaterialParameterSpec;
|
||||
import sun.security.internal.spec.TlsKeyMaterialSpec;
|
||||
|
||||
@ -60,8 +60,7 @@ public class TestKeyMaterial extends PKCS11Test {
|
||||
@Override
|
||||
public void main(Provider provider) throws Exception {
|
||||
if (provider.getService("KeyGenerator", "SunTlsKeyMaterial") == null) {
|
||||
System.out.println("Provider does not support algorithm, skipping");
|
||||
return;
|
||||
throw new SkippedException("Provider does not support algorithm, skipping");
|
||||
}
|
||||
|
||||
try (BufferedReader reader = Files.newBufferedReader(
|
||||
|
||||
@ -35,6 +35,8 @@ import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
import java.security.Provider;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
|
||||
import sun.security.internal.spec.TlsMasterSecretParameterSpec;
|
||||
import sun.security.internal.spec.TlsKeyMaterialParameterSpec;
|
||||
@ -52,20 +54,17 @@ public class TestKeyMaterialChaCha20 extends PKCS11Test {
|
||||
try {
|
||||
kg1 = KeyGenerator.getInstance("SunTlsRsaPremasterSecret", provider);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Skipping, SunTlsRsaPremasterSecret KeyGenerator not supported");
|
||||
return;
|
||||
throw new SkippedException("Skipping, SunTlsRsaPremasterSecret KeyGenerator not supported");
|
||||
}
|
||||
try {
|
||||
kg2 = KeyGenerator.getInstance("SunTls12MasterSecret", provider);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Skipping, SunTls12MasterSecret KeyGenerator not supported");
|
||||
return;
|
||||
throw new SkippedException("Skipping, SunTls12MasterSecret KeyGenerator not supported");
|
||||
}
|
||||
try {
|
||||
kg3 = KeyGenerator.getInstance("SunTls12KeyMaterial", provider);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Skipping, SunTls12KeyMaterial KeyGenerator not supported");
|
||||
return;
|
||||
throw new SkippedException("Skipping, SunTls12KeyMaterial KeyGenerator not supported");
|
||||
}
|
||||
|
||||
kg1.init(new TlsRsaPremasterSecretParameterSpec(0x0303, 0x0303));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, 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
|
||||
@ -42,6 +42,8 @@ import java.util.Arrays;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
import sun.security.internal.interfaces.TlsMasterSecret;
|
||||
import sun.security.internal.spec.TlsMasterSecretParameterSpec;
|
||||
|
||||
@ -56,8 +58,7 @@ public class TestMasterSecret extends PKCS11Test {
|
||||
@Override
|
||||
public void main(Provider provider) throws Exception {
|
||||
if (provider.getService("KeyGenerator", "SunTlsMasterSecret") == null) {
|
||||
System.out.println("Not supported by provider, skipping");
|
||||
return;
|
||||
throw new SkippedException("Not supported by provider, skipping");
|
||||
}
|
||||
|
||||
try (BufferedReader reader = Files.newBufferedReader(
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, 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
|
||||
@ -40,6 +40,8 @@ import java.util.Arrays;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
import sun.security.internal.spec.TlsPrfParameterSpec;
|
||||
|
||||
public class TestPRF extends PKCS11Test {
|
||||
@ -53,8 +55,7 @@ public class TestPRF extends PKCS11Test {
|
||||
@Override
|
||||
public void main(Provider provider) throws Exception {
|
||||
if (provider.getService("KeyGenerator", "SunTlsPrf") == null) {
|
||||
System.out.println("Provider does not support algorithm, skipping");
|
||||
return;
|
||||
throw new SkippedException("Provider does not support algorithm, skipping");
|
||||
}
|
||||
|
||||
try (BufferedReader reader = Files.newBufferedReader(
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, 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
|
||||
@ -36,6 +36,8 @@ import java.security.Provider;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
|
||||
|
||||
public class TestPremaster extends PKCS11Test {
|
||||
@ -48,8 +50,7 @@ public class TestPremaster extends PKCS11Test {
|
||||
public void main(Provider provider) throws Exception {
|
||||
if (provider.getService(
|
||||
"KeyGenerator", "SunTlsRsaPremasterSecret") == null) {
|
||||
System.out.println("Not supported by provider, skipping");
|
||||
return;
|
||||
throw new SkippedException("Not supported by provider, skipping");
|
||||
}
|
||||
KeyGenerator kg;
|
||||
kg = KeyGenerator.getInstance("SunTlsRsaPremasterSecret", provider);
|
||||
@ -87,8 +88,7 @@ public class TestPremaster extends PKCS11Test {
|
||||
} catch (InvalidAlgorithmParameterException iape) {
|
||||
// S12 removed support for SSL v3.0
|
||||
if (clientVersion == 0x300 || serverVersion == 0x300) {
|
||||
System.out.println("Skip testing SSLv3 due to no support");
|
||||
return;
|
||||
throw new SkippedException("Skip testing SSLv3 due to no support");
|
||||
}
|
||||
// unexpected, pass it up
|
||||
throw iape;
|
||||
|
||||
@ -71,6 +71,7 @@ import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
|
||||
import jdk.test.lib.security.SecurityUtils;
|
||||
import jtreg.SkippedException;
|
||||
import sun.security.internal.spec.TlsMasterSecretParameterSpec;
|
||||
import sun.security.internal.spec.TlsPrfParameterSpec;
|
||||
import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
|
||||
@ -94,12 +95,11 @@ public final class FipsModeTLS extends SecmodTest {
|
||||
try {
|
||||
initialize();
|
||||
} catch (Exception e) {
|
||||
System.out.println("Test skipped: failure during" +
|
||||
" initialization");
|
||||
if (enableDebug) {
|
||||
System.out.println(e);
|
||||
}
|
||||
return;
|
||||
throw new SkippedException("Test skipped: failure during" +
|
||||
" initialization");
|
||||
}
|
||||
|
||||
if (shouldRun()) {
|
||||
@ -112,8 +112,8 @@ public final class FipsModeTLS extends SecmodTest {
|
||||
|
||||
System.out.println("Test PASS - OK");
|
||||
} else {
|
||||
System.out.println("Test skipped: TLS 1.2 mechanisms" +
|
||||
" not supported by current SunPKCS11 back-end");
|
||||
throw new SkippedException("Test skipped: TLS 1.2 mechanisms" +
|
||||
" not supported by current SunPKCS11 back-end");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user