211 * @throws IllegalArgumentException if the provider name is {@code null}
212 * or empty
213 *
214 * @throws NoSuchAlgorithmException if an
215 * {@code AlgorithmParameterGeneratorSpi}
216 * implementation for the specified algorithm is not
217 * available from the specified provider
218 *
219 * @throws NoSuchProviderException if the specified provider is not
220 * registered in the security provider list
221 *
222 * @throws NullPointerException if {@code algorithm} is {@code null}
223 *
224 * @see Provider
225 */
226 public static AlgorithmParameterGenerator getInstance(String algorithm,
227 String provider)
228 throws NoSuchAlgorithmException, NoSuchProviderException
229 {
230 Objects.requireNonNull(algorithm, "null algorithm name");
231 if (provider == null || provider.length() == 0)
232 throw new IllegalArgumentException("missing provider");
233 Object[] objs = Security.getImpl(algorithm,
234 "AlgorithmParameterGenerator",
235 provider);
236 return new AlgorithmParameterGenerator
237 ((AlgorithmParameterGeneratorSpi)objs[0], (Provider)objs[1],
238 algorithm);
239 }
240
241 /**
242 * Returns an AlgorithmParameterGenerator object for generating
243 * a set of parameters to be used with the specified algorithm.
244 *
245 * <p> A new AlgorithmParameterGenerator object encapsulating the
246 * AlgorithmParameterGeneratorSpi implementation from the specified Provider
247 * object is returned. Note that the specified Provider object
248 * does not have to be registered in the provider list.
249 *
250 * @param algorithm the string name of the algorithm this
251 * parameter generator is associated with.
|
211 * @throws IllegalArgumentException if the provider name is {@code null}
212 * or empty
213 *
214 * @throws NoSuchAlgorithmException if an
215 * {@code AlgorithmParameterGeneratorSpi}
216 * implementation for the specified algorithm is not
217 * available from the specified provider
218 *
219 * @throws NoSuchProviderException if the specified provider is not
220 * registered in the security provider list
221 *
222 * @throws NullPointerException if {@code algorithm} is {@code null}
223 *
224 * @see Provider
225 */
226 public static AlgorithmParameterGenerator getInstance(String algorithm,
227 String provider)
228 throws NoSuchAlgorithmException, NoSuchProviderException
229 {
230 Objects.requireNonNull(algorithm, "null algorithm name");
231 if (provider == null || provider.isEmpty())
232 throw new IllegalArgumentException("missing provider");
233 Object[] objs = Security.getImpl(algorithm,
234 "AlgorithmParameterGenerator",
235 provider);
236 return new AlgorithmParameterGenerator
237 ((AlgorithmParameterGeneratorSpi)objs[0], (Provider)objs[1],
238 algorithm);
239 }
240
241 /**
242 * Returns an AlgorithmParameterGenerator object for generating
243 * a set of parameters to be used with the specified algorithm.
244 *
245 * <p> A new AlgorithmParameterGenerator object encapsulating the
246 * AlgorithmParameterGeneratorSpi implementation from the specified Provider
247 * object is returned. Note that the specified Provider object
248 * does not have to be registered in the provider list.
249 *
250 * @param algorithm the string name of the algorithm this
251 * parameter generator is associated with.
|