Ejemplo n.º 1
0
 static Instance getInstance(String type, Class<?> clazz, String algorithm, String provider)
     throws NoSuchAlgorithmException, NoSuchProviderException {
   Service s = GetInstance.getService(type, algorithm, provider);
   Exception ve = getVerificationResult(s.getProvider());
   if (ve != null) {
     String msg = "JCE cannot authenticate the provider " + provider;
     throw (NoSuchProviderException) new NoSuchProviderException(msg).initCause(ve);
   }
   return GetInstance.getInstance(s, clazz);
 }
Ejemplo n.º 2
0
 static Instance getInstance(String type, Class<?> clazz, String algorithm, Provider provider)
     throws NoSuchAlgorithmException {
   Service s = GetInstance.getService(type, algorithm, provider);
   Exception ve = JceSecurity.getVerificationResult(provider);
   if (ve != null) {
     String msg = "JCE cannot authenticate the provider " + provider.getName();
     throw new SecurityException(msg, ve);
   }
   return GetInstance.getInstance(s, clazz);
 }
Ejemplo n.º 3
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);
 }