3232import java .security .spec .AlgorithmParameterSpec ;
3333import java .security .spec .MGF1ParameterSpec ;
3434import java .security .spec .PSSParameterSpec ;
35+ import java .util .ArrayList ;
36+ import java .util .List ;
37+
3538import jtreg .SkippedException ;
3639
3740/**
@@ -78,10 +81,11 @@ public class SignatureTestPSS extends PKCS11Test {
7881 */
7982 private static final int UPDATE_TIMES_HUNDRED = 100 ;
8083
81- private static boolean skipTest = true ;
84+ private static final List < String > skippedAlgs = new ArrayList <>() ;
8285
8386 public static void main (String [] args ) throws Exception {
84- DIGESTS = (args .length > 0 && "sha3" .equals (args [0 ]))? SHA3_DIGESTS : SHA_DIGESTS ;
87+ DIGESTS = (args .length > 0 && "sha3" .equals (args [0 ])) ?
88+ SHA3_DIGESTS : SHA_DIGESTS ;
8589
8690 main (new SignatureTestPSS (), args );
8791 }
@@ -105,16 +109,17 @@ public void main(Provider p) throws Exception {
105109 PSSUtil .isHashSupported (p , hash , mgfHash );
106110 if (s == PSSUtil .AlgoSupport .NO ) {
107111 System .out .println (" => Skip; no support" );
112+ skippedAlgs .add ("[Hash = " + hash +
113+ ", MGF1 Hash = " + mgfHash + "]" );
108114 continue ;
109115 }
110116 checkSignature (p , DATA , pubKey , privKey , hash , mgfHash , s );
111117 }
112118 };
113119 }
114120
115- // start testing below
116- if (skipTest ) {
117- throw new SkippedException ("Test Skipped" );
121+ if (!skippedAlgs .isEmpty ()) {
122+ throw new SkippedException ("Test Skipped :" + skippedAlgs );
118123 }
119124 }
120125
@@ -143,14 +148,20 @@ private static void checkSignature(Provider p, byte[] data, PublicKey pub,
143148 hash ,
144149 mgfHash ,
145150 s );
146- skipTest = true ;
151+ skippedAlgs .add (String .format (
152+ "[public key: %s, private key: %s, " +
153+ "hash: %s, mgf hash: %s, Algo Support: %s]" ,
154+ pub ,
155+ priv ,
156+ hash ,
157+ mgfHash ,
158+ s )
159+ );
147160 return ;
148161 } else {
149162 throw new RuntimeException ("Unexpected Exception" , iape );
150163 }
151164 }
152- // start testing below
153- skipTest = false ;
154165
155166 for (int i = 0 ; i < UPDATE_TIMES_HUNDRED ; i ++) {
156167 sig .update (data );
0 commit comments