< prev index next >

test/jdk/java/security/MessageDigest/TestDigestIOStream.java

Print this page
rev 59383 : [mq]: final

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, 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.

@@ -66,11 +66,10 @@
         test.run();
     }
 
     public void run() throws Exception {
         for (String algorithm : ALGORITHM_ARRAY) {
-            try {
                 md = MessageDigest.getInstance(algorithm);
                 for (int length : DATA_LEN_ARRAY) {
 
                     Random rdm = RandomFactory.getRandom();
                     data = new byte[length];

@@ -99,39 +98,17 @@
                                     "testDigestOff failed at:" + algorithm + "/"
                                             + length + "/" + readModel);
                         }
                     }
                 }
-            } catch (NoSuchAlgorithmException nae) {
-                if (algorithm.startsWith("SHA3") && !isSHA3supported()) {
-                    continue;
-                } else {
-                    throw nae;
-                }
-            }
         }
         int testNumber = ALGORITHM_ARRAY.length * ReadModel.values().length
                 * DATA_LEN_ARRAY.length * 2
                 + ALGORITHM_ARRAY.length * DATA_LEN_ARRAY.length * 2;
         out.println("All " + testNumber + " Tests Passed");
     }
 
-    // SHA-3 hash algorithms are only supported by "SUN" provider
-    // and "OracleUcrypto" provider on Solaris 12.0 or later
-    // This method checks if system supports SHA-3
-    private boolean isSHA3supported() {
-        if (Security.getProvider("SUN") != null) {
-            return true;
-        }
-        if (Security.getProvider("OracleUcrypto") != null
-                && "SunOS".equals(System.getProperty("os.name"))
-                && System.getProperty("os.version").compareTo("5.12") >= 0) {
-            return true;
-        }
-        return false;
-    }
-
     /**
      * Test DigestInputStream and DigestOutputStream digest function when digest
      * set on and off
      *
      * @param algo
< prev index next >