jdk/src/share/classes/javax/crypto/KeyGenerator.java
changeset 10336 0bb1999251f8
parent 9035 1255eb81cc2f
child 18771 9dadb0719cea
equal deleted inserted replaced
10335:3c7eda3ab2f5 10336:0bb1999251f8
   125     // The algorithm
   125     // The algorithm
   126     private final String algorithm;
   126     private final String algorithm;
   127 
   127 
   128     private final Object lock = new Object();
   128     private final Object lock = new Object();
   129 
   129 
   130     private Iterator serviceIterator;
   130     private Iterator<Service> serviceIterator;
   131 
   131 
   132     private int initType;
   132     private int initType;
   133     private int initKeySize;
   133     private int initKeySize;
   134     private AlgorithmParameterSpec initParams;
   134     private AlgorithmParameterSpec initParams;
   135     private SecureRandom initRandom;
   135     private SecureRandom initRandom;
   148         this.algorithm = algorithm;
   148         this.algorithm = algorithm;
   149     }
   149     }
   150 
   150 
   151     private KeyGenerator(String algorithm) throws NoSuchAlgorithmException {
   151     private KeyGenerator(String algorithm) throws NoSuchAlgorithmException {
   152         this.algorithm = algorithm;
   152         this.algorithm = algorithm;
   153         List list = GetInstance.getServices("KeyGenerator", algorithm);
   153         List<Service> list =
       
   154                 GetInstance.getServices("KeyGenerator", algorithm);
   154         serviceIterator = list.iterator();
   155         serviceIterator = list.iterator();
   155         initType = I_NONE;
   156         initType = I_NONE;
   156         // fetch and instantiate initial spi
   157         // fetch and instantiate initial spi
   157         if (nextSpi(null, false) == null) {
   158         if (nextSpi(null, false) == null) {
   158             throw new NoSuchAlgorithmException
   159             throw new NoSuchAlgorithmException
   318             }
   319             }
   319             if (serviceIterator == null) {
   320             if (serviceIterator == null) {
   320                 return null;
   321                 return null;
   321             }
   322             }
   322             while (serviceIterator.hasNext()) {
   323             while (serviceIterator.hasNext()) {
   323                 Service s = (Service)serviceIterator.next();
   324                 Service s = serviceIterator.next();
   324                 if (JceSecurity.canUseProvider(s.getProvider()) == false) {
   325                 if (JceSecurity.canUseProvider(s.getProvider()) == false) {
   325                     continue;
   326                     continue;
   326                 }
   327                 }
   327                 try {
   328                 try {
   328                     Object inst = s.newInstance(null);
   329                     Object inst = s.newInstance(null);