< prev index next >

test/jdk/com/sun/crypto/provider/Cipher/RSA/TestOAEPPadding.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -128,10 +128,20 @@
                 MGF1ParameterSpec.SHA256, PSource.PSpecified.DEFAULT));
         test(new OAEPParameterSpec("SHA-512", "MGF1",
                 MGF1ParameterSpec.SHA384, PSource.PSpecified.DEFAULT));
         test(new OAEPParameterSpec("SHA-512", "MGF1",
                 MGF1ParameterSpec.SHA512, PSource.PSpecified.DEFAULT));
+        // SHA-512/224 and SHA-512/256
+        test(new OAEPParameterSpec("SHA-512/224", "MGF1",
+                MGF1ParameterSpec.SHA224, PSource.PSpecified.DEFAULT));
+        test(new OAEPParameterSpec("SHA-512/224", "MGF1",
+                MGF1ParameterSpec.SHA512_224, PSource.PSpecified.DEFAULT));
+        test(new OAEPParameterSpec("SHA-512/256", "MGF1",
+                MGF1ParameterSpec.SHA384, PSource.PSpecified.DEFAULT));
+        test(new OAEPParameterSpec("SHA-512/256", "MGF1",
+                MGF1ParameterSpec.SHA512, PSource.PSpecified.DEFAULT));
+
         if (failed) {
             throw new Exception("Test failed");
         }
     }
 

@@ -152,13 +162,13 @@
             algo = spec.getDigestAlgorithm();
             if (algo.equals("MD5")) {
                 dlen = 16;
             } else if (algo.equals("SHA1")) {
                 dlen = 20;
-            } else if (algo.equals("SHA-224")) {
+            } else if (algo.equals("SHA-224") || algo.equals("SHA-512/224")) {
                 dlen = 28;
-            } else if (algo.equals("SHA-256")) {
+            } else if (algo.equals("SHA-256") || algo.equals("SHA-512/256")) {
                 dlen = 32;
             } else if (algo.equals("SHA-384")) {
                 dlen = 48;
             } else if (algo.equals("SHA-512")) {
                 dlen = 64;
< prev index next >