Esempio n. 1
0
 static Instance getInstance(String type, Class<?> clazz, String algorithm)
     throws NoSuchAlgorithmException {
   List<Service> services = GetInstance.getServices(type, algorithm);
   NoSuchAlgorithmException failure = null;
   for (Service s : services) {
     if (canUseProvider(s.getProvider()) == false) {
       // allow only signed providers
       continue;
     }
     try {
       Instance instance = GetInstance.getInstance(s, clazz);
       return instance;
     } catch (NoSuchAlgorithmException e) {
       failure = e;
     }
   }
   throw new NoSuchAlgorithmException("Algorithm " + algorithm + " not available", failure);
 }