Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/security/AlgorithmParameterGeneratorSpi.java
38829 views
/*1* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.security;2627import java.security.spec.AlgorithmParameterSpec;2829/**30* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)31* for the {@code AlgorithmParameterGenerator} class, which32* is used to generate a set of parameters to be used with a certain algorithm.33*34* <p> All the abstract methods in this class must be implemented by each35* cryptographic service provider who wishes to supply the implementation36* of a parameter generator for a particular algorithm.37*38* <p> In case the client does not explicitly initialize the39* AlgorithmParameterGenerator (via a call to an {@code engineInit}40* method), each provider must supply (and document) a default initialization.41* For example, the Sun provider uses a default modulus prime size of 102442* bits for the generation of DSA parameters.43*44* @author Jan Luehe45*46*47* @see AlgorithmParameterGenerator48* @see AlgorithmParameters49* @see java.security.spec.AlgorithmParameterSpec50*51* @since 1.252*/5354public abstract class AlgorithmParameterGeneratorSpi {5556/**57* Initializes this parameter generator for a certain size58* and source of randomness.59*60* @param size the size (number of bits).61* @param random the source of randomness.62*/63protected abstract void engineInit(int size, SecureRandom random);6465/**66* Initializes this parameter generator with a set of67* algorithm-specific parameter generation values.68*69* @param genParamSpec the set of algorithm-specific parameter generation values.70* @param random the source of randomness.71*72* @exception InvalidAlgorithmParameterException if the given parameter73* generation values are inappropriate for this parameter generator.74*/75protected abstract void engineInit(AlgorithmParameterSpec genParamSpec,76SecureRandom random)77throws InvalidAlgorithmParameterException;7879/**80* Generates the parameters.81*82* @return the new AlgorithmParameters object.83*/84protected abstract AlgorithmParameters engineGenerateParameters();85}868788