equal
deleted
inserted
replaced
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.crypto.provider; |
26 package com.sun.crypto.provider; |
27 |
27 |
28 import java.io.UnsupportedEncodingException; |
|
29 import java.math.BigInteger; |
28 import java.math.BigInteger; |
30 import java.security.*; |
29 import java.security.*; |
31 import java.security.spec.*; |
30 import java.security.spec.*; |
32 import java.util.Arrays; |
31 import java.util.Arrays; |
33 import javax.crypto.*; |
32 import javax.crypto.*; |
230 SunJCE.getRandom().nextBytes(salt); |
229 SunJCE.getRandom().nextBytes(salt); |
231 iCount = DEFAULT_COUNT; |
230 iCount = DEFAULT_COUNT; |
232 } |
231 } |
233 PBEParameterSpec pbeSpec = new PBEParameterSpec(salt, iCount); |
232 PBEParameterSpec pbeSpec = new PBEParameterSpec(salt, iCount); |
234 try { |
233 try { |
235 params = AlgorithmParameters.getInstance(pbeAlgo, "SunJCE"); |
234 params = AlgorithmParameters.getInstance(pbeAlgo, |
236 } catch (GeneralSecurityException gse) { |
235 SunJCE.getInstance()); |
|
236 params.init(pbeSpec); |
|
237 } catch (NoSuchAlgorithmException nsae) { |
237 // should never happen |
238 // should never happen |
238 throw new RuntimeException( |
239 throw new RuntimeException( |
239 "SunJCE provider is not configured properly"); |
240 "SunJCE provider is not configured properly"); |
240 } |
|
241 try { |
|
242 params.init(pbeSpec); |
|
243 } catch (InvalidParameterSpecException ipse) { |
241 } catch (InvalidParameterSpecException ipse) { |
244 // should never happen |
242 // should never happen |
245 throw new RuntimeException("PBEParameterSpec not supported"); |
243 throw new RuntimeException("PBEParameterSpec not supported"); |
246 } |
244 } |
247 return params; |
245 return params; |