Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -45,6 +44,7 @@
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;

Expand All @@ -60,8 +60,7 @@ public static void main(String[] args) throws Exception {
@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(
Expand Down
11 changes: 5 additions & 6 deletions test/jdk/sun/security/pkcs11/tls/TestKeyMaterialChaCha20.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
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;
Expand All @@ -52,20 +54,17 @@ public void main(Provider provider) throws Exception {
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));
Expand Down
7 changes: 4 additions & 3 deletions test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -42,6 +42,8 @@
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;

Expand All @@ -56,8 +58,7 @@ public static void main(String[] args) throws Exception {
@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(
Expand Down
7 changes: 4 additions & 3 deletions test/jdk/sun/security/pkcs11/tls/TestPRF.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -40,6 +40,8 @@
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 {
Expand All @@ -53,8 +55,7 @@ public static void main(String[] args) throws Exception {
@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(
Expand Down
10 changes: 5 additions & 5 deletions test/jdk/sun/security/pkcs11/tls/TestPremaster.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -36,6 +36,8 @@
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 {
Expand All @@ -48,8 +50,7 @@ public static void main(String[] args) throws Exception {
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);
Expand Down Expand Up @@ -87,8 +88,7 @@ private static void test(KeyGenerator kg,
} 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;
Expand Down
10 changes: 5 additions & 5 deletions test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
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;
Expand All @@ -88,12 +89,11 @@ public static void main(String[] args) throws Exception {
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()) {
Expand All @@ -105,8 +105,8 @@ public static void main(String[] args) throws Exception {

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");
}
}

Expand Down