1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
317 *
318 * @param size the size (number of bits).
319 * @param random the source of randomness.
320 */
321 public final void init(int size, SecureRandom random) {
322 paramGenSpi.engineInit(size, random);
323 }
324
325 /**
326 * Initializes this parameter generator with a set of algorithm-specific
327 * parameter generation values.
328 * To generate the parameters, the {@code SecureRandom}
329 * implementation of the highest-priority installed provider is used as
330 * the source of randomness.
331 * (If none of the installed providers supply an implementation of
332 * {@code SecureRandom}, a system-provided source of randomness is
333 * used.)
334 *
335 * @param genParamSpec the set of algorithm-specific parameter generation values.
336 *
337 * @exception InvalidAlgorithmParameterException if the given parameter
338 * generation values are inappropriate for this parameter generator.
339 */
340 public final void init(AlgorithmParameterSpec genParamSpec)
341 throws InvalidAlgorithmParameterException {
342 paramGenSpi.engineInit(genParamSpec, new SecureRandom());
343 }
344
345 /**
346 * Initializes this parameter generator with a set of algorithm-specific
347 * parameter generation values.
348 *
349 * @param genParamSpec the set of algorithm-specific parameter generation values.
350 * @param random the source of randomness.
351 *
352 * @exception InvalidAlgorithmParameterException if the given parameter
353 * generation values are inappropriate for this parameter generator.
354 */
355 public final void init(AlgorithmParameterSpec genParamSpec,
356 SecureRandom random)
357 throws InvalidAlgorithmParameterException {
358 paramGenSpi.engineInit(genParamSpec, random);
359 }
360
361 /**
362 * Generates the parameters.
363 *
364 * @return the new AlgorithmParameters object.
365 */
366 public final AlgorithmParameters generateParameters() {
367 return paramGenSpi.engineGenerateParameters();
368 }
369 }
|
1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
317 *
318 * @param size the size (number of bits).
319 * @param random the source of randomness.
320 */
321 public final void init(int size, SecureRandom random) {
322 paramGenSpi.engineInit(size, random);
323 }
324
325 /**
326 * Initializes this parameter generator with a set of algorithm-specific
327 * parameter generation values.
328 * To generate the parameters, the {@code SecureRandom}
329 * implementation of the highest-priority installed provider is used as
330 * the source of randomness.
331 * (If none of the installed providers supply an implementation of
332 * {@code SecureRandom}, a system-provided source of randomness is
333 * used.)
334 *
335 * @param genParamSpec the set of algorithm-specific parameter generation values.
336 *
337 * @throws InvalidAlgorithmParameterException if the given parameter
338 * generation values are inappropriate for this parameter generator.
339 */
340 public final void init(AlgorithmParameterSpec genParamSpec)
341 throws InvalidAlgorithmParameterException {
342 paramGenSpi.engineInit(genParamSpec, new SecureRandom());
343 }
344
345 /**
346 * Initializes this parameter generator with a set of algorithm-specific
347 * parameter generation values.
348 *
349 * @param genParamSpec the set of algorithm-specific parameter generation values.
350 * @param random the source of randomness.
351 *
352 * @throws InvalidAlgorithmParameterException if the given parameter
353 * generation values are inappropriate for this parameter generator.
354 */
355 public final void init(AlgorithmParameterSpec genParamSpec,
356 SecureRandom random)
357 throws InvalidAlgorithmParameterException {
358 paramGenSpi.engineInit(genParamSpec, random);
359 }
360
361 /**
362 * Generates the parameters.
363 *
364 * @return the new AlgorithmParameters object.
365 */
366 public final AlgorithmParameters generateParameters() {
367 return paramGenSpi.engineGenerateParameters();
368 }
369 }
|