jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java
changeset 16909 78a1749a43e2
parent 15010 ec6b49ce42b1
child 21278 ef8a3a2a72f2
equal deleted inserted replaced
16850:f6f6c2182678 16909:78a1749a43e2
   167             SunJCE.getRandom().nextBytes(salt);
   167             SunJCE.getRandom().nextBytes(salt);
   168         }
   168         }
   169         PBEParameterSpec pbeSpec = new PBEParameterSpec(salt, iCount);
   169         PBEParameterSpec pbeSpec = new PBEParameterSpec(salt, iCount);
   170         try {
   170         try {
   171             params = AlgorithmParameters.getInstance("PBEWithMD5And" +
   171             params = AlgorithmParameters.getInstance("PBEWithMD5And" +
   172                 (algo.equalsIgnoreCase("DES")? "DES":"TripleDES"), "SunJCE");
   172                 (algo.equalsIgnoreCase("DES")? "DES":"TripleDES"),
       
   173                     SunJCE.getInstance());
       
   174             params.init(pbeSpec);
   173         } catch (NoSuchAlgorithmException nsae) {
   175         } catch (NoSuchAlgorithmException nsae) {
   174             // should never happen
   176             // should never happen
   175             throw new RuntimeException("SunJCE called, but not configured");
   177             throw new RuntimeException("SunJCE called, but not configured");
   176         } catch (NoSuchProviderException nspe) {
       
   177             // should never happen
       
   178             throw new RuntimeException("SunJCE called, but not configured");
       
   179         }
       
   180         try {
       
   181             params.init(pbeSpec);
       
   182         } catch (InvalidParameterSpecException ipse) {
   178         } catch (InvalidParameterSpecException ipse) {
   183             // should never happen
   179             // should never happen
   184             throw new RuntimeException("PBEParameterSpec not supported");
   180             throw new RuntimeException("PBEParameterSpec not supported");
   185         }
   181         }
   186         return params;
   182         return params;