< prev index next >

test/jdk/sun/security/rsa/pss/PSSParametersTest.java

Print this page
@@ -29,11 +29,11 @@
  import static javax.crypto.Cipher.PRIVATE_KEY;
  import static javax.crypto.Cipher.PUBLIC_KEY;
  
  /**
   * @test
-  * @bug 8146293 8242556
+  * @bug 8146293 8242556 8172366
   * @summary Test RSASSA-PSS AlgorithmParameters impl of SunRsaSign provider.
   * @run main PSSParametersTest
   */
  public class PSSParametersTest {
      /**

@@ -48,30 +48,33 @@
          System.out.println("Testing against DEFAULT parameters");
          test(PSSParameterSpec.DEFAULT);
          System.out.println("Testing against custom parameters");
          test(new PSSParameterSpec("SHA-512/224", "MGF1",
                  MGF1ParameterSpec.SHA384, 100, 1));
+         test(new PSSParameterSpec("SHA3-256", "MGF1",
+             new MGF1ParameterSpec("SHA3-256"), 256>>3, 1));
          System.out.println("Test Passed");
      }
  
      // test the given spec by first initializing w/ it, generate the DER
      // bytes, then initialize w/ the DER bytes, retrieve the spec.
      // compare both spec for equality and throw exception if the check failed.
      private static void test(PSSParameterSpec spec) throws Exception {
+         System.out.println("Testing PSS spec: " + spec);
          String ALGORITHMS[] = { PSS_ALGO, PSS_OID };
          for (String alg : ALGORITHMS) {
              AlgorithmParameters params = AlgorithmParameters.getInstance
                      (alg, PROVIDER);
              params.init(spec);
              byte[] encoded = params.getEncoded();
              AlgorithmParameters params2 = AlgorithmParameters.getInstance
                      (alg, PROVIDER);
              params2.init(encoded);
              PSSParameterSpec spec2 = params2.getParameterSpec
-                 (PSSParameterSpec.class);
+                     (PSSParameterSpec.class);
              if (!isEqual(spec, spec2)) {
-                 throw new RuntimeException("Spec check Failed for " +  alg);
+                 throw new RuntimeException("Spec check Failed for " + alg);
              }
          }
      }
  
      private static boolean isEqual(PSSParameterSpec spec,
< prev index next >