< prev index next >

test/jdk/java/security/MessageDigest/UnsupportedProvider.java

Print this page
rev 59107 : imported patch security


  50                                 + provName + " provider, but expected "
  51                                 + "NoSuchAlgorithmException is not thrown");
  52                     }
  53                 } catch (NoSuchAlgorithmException ex) {
  54                     if (isSHA3Supported(prov.getName())) {
  55                         throw new RuntimeException("SHA-3 should be supported "
  56                                 + "by " + prov.getName() + " provider, got"
  57                                 + " unexpected NoSuchAlgorithmException");
  58                     }
  59                     continue;
  60                 }
  61             }
  62         }
  63     }
  64 
  65     // Check if specific provider supports SHA-3 hash algorithms
  66     static boolean isSHA3Supported(String provName) {
  67         if ("SUN".equals(provName)) {
  68             return true;
  69         }
  70         if ("OracleUcrypto".equals(provName)
  71                 && "SunOS".equals(System.getProperty("os.name"))
  72                 && System.getProperty("os.version").compareTo("5.12") >= 0) {
  73             return true;
  74         }
  75         return false;
  76     }
  77 }


  50                                 + provName + " provider, but expected "
  51                                 + "NoSuchAlgorithmException is not thrown");
  52                     }
  53                 } catch (NoSuchAlgorithmException ex) {
  54                     if (isSHA3Supported(prov.getName())) {
  55                         throw new RuntimeException("SHA-3 should be supported "
  56                                 + "by " + prov.getName() + " provider, got"
  57                                 + " unexpected NoSuchAlgorithmException");
  58                     }
  59                     continue;
  60                 }
  61             }
  62         }
  63     }
  64 
  65     // Check if specific provider supports SHA-3 hash algorithms
  66     static boolean isSHA3Supported(String provName) {
  67         if ("SUN".equals(provName)) {
  68             return true;
  69         }





  70         return false;
  71     }
  72 }
< prev index next >