11/*
2- * Copyright (c) 2011, 2016 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2011, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
2828 * java.base/sun.security.tools.keytool
2929 * @requires os.family == "windows"
3030 * @summary Sign using the NONEwithRSA signature algorithm from SunMSCAPI
31+ * @library /test/lib/
3132 */
3233
33- import java .security .*;
34+ import java .security .KeyPair ;
35+ import java .security .KeyPairGenerator ;
36+ import java .security .PrivateKey ;
37+ import java .security .Provider ;
38+ import java .security .PublicKey ;
39+ import java .security .Security ;
40+ import java .security .Signature ;
41+ import java .security .SignatureException ;
3442import java .security .cert .X509Certificate ;
3543import java .security .interfaces .RSAPrivateCrtKey ;
36- import java .util .*;
44+ import java .util .ArrayList ;
45+ import java .util .Enumeration ;
46+ import java .util .List ;
47+
48+ import jtreg .SkippedException ;
3749import sun .security .tools .keytool .CertAndKeyGen ;
3850import sun .security .x509 .X500Name ;
3951
@@ -91,9 +103,8 @@ public static void main(String[] args) throws Exception {
91103 if (providers == null ) {
92104 System .out .println ("No JCE providers support the " +
93105 "'Signature.NONEwithRSA' algorithm" );
94- System .out .println ("Skipping this test..." );
95- return ;
96-
106+ throw new SkippedException ("No JCE providers support the " +
107+ "'Signature.NONEwithRSA' algorithm" );
97108 } else {
98109 System .out .println ("The following JCE providers support the " +
99110 "'Signature.NONEwithRSA' algorithm: " );
@@ -109,7 +120,8 @@ public static void main(String[] args) throws Exception {
109120 ckg .generate (1024 );
110121 RSAPrivateCrtKey k = (RSAPrivateCrtKey ) ckg .getPrivateKey ();
111122 ks .setKeyEntry ("6578658" , k , null , new X509Certificate []{
112- ckg .getSelfCertificate (new X500Name ("cn=6578658,c=US" ), 1000 )
123+ ckg .getSelfCertificate (
124+ new X500Name ("cn=6578658,c=US" ), 1000 )
113125 });
114126 ks .store (null , null );
115127
0 commit comments