0N/A/*
2362N/A * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.security.interfaces;
0N/A
0N/Aimport java.security.*;
0N/A
0N/A/**
0N/A * An interface to an object capable of generating DSA key pairs.
0N/A *
0N/A * <p>The <code>initialize</code> methods may each be called any number
0N/A * of times. If no <code>initialize</code> method is called on a
0N/A * DSAKeyPairGenerator, the default is to generate 1024-bit keys, using
0N/A * precomputed p, q and g parameters and an instance of SecureRandom as
0N/A * the random bit source.
0N/A *
0N/A * <p>Users wishing to indicate DSA-specific parameters, and to generate a key
0N/A * pair suitable for use with the DSA algorithm typically
0N/A *
0N/A * <ol>
0N/A *
0N/A * <li>Get a key pair generator for the DSA algorithm by calling the
0N/A * KeyPairGenerator <code>getInstance</code> method with "DSA"
0N/A * as its argument.<p>
0N/A *
0N/A * <li>Initialize the generator by casting the result to a DSAKeyPairGenerator
0N/A * and calling one of the
0N/A * <code>initialize</code> methods from this DSAKeyPairGenerator interface.<p>
0N/A *
0N/A * <li>Generate a key pair by calling the <code>generateKeyPair</code>
0N/A * method from the KeyPairGenerator class.
0N/A *
0N/A * </ol>
0N/A *
0N/A * <p>Note: it is not always necessary to do do algorithm-specific
0N/A * initialization for a DSA key pair generator. That is, it is not always
0N/A * necessary to call an <code>initialize</code> method in this interface.
0N/A * Algorithm-independent initialization using the <code>initialize</code> method
0N/A * in the KeyPairGenerator
0N/A * interface is all that is needed when you accept defaults for algorithm-specific
0N/A * parameters.
0N/A *
0N/A * @see java.security.KeyPairGenerator
0N/A */
0N/Apublic interface DSAKeyPairGenerator {
0N/A
0N/A /**
0N/A * Initializes the key pair generator using the DSA family parameters
0N/A * (p,q and g) and an optional SecureRandom bit source. If a
0N/A * SecureRandom bit source is needed but not supplied, i.e. null, a
0N/A * default SecureRandom instance will be used.
0N/A *
0N/A * @param params the parameters to use to generate the keys.
0N/A *
0N/A * @param random the random bit source to use to generate key bits;
0N/A * can be null.
0N/A *
0N/A * @exception InvalidParameterException if the <code>params</code>
0N/A * value is invalid or null.
0N/A */
0N/A public void initialize(DSAParams params, SecureRandom random)
0N/A throws InvalidParameterException;
0N/A
0N/A /**
0N/A * Initializes the key pair generator for a given modulus length
0N/A * (instead of parameters), and an optional SecureRandom bit source.
0N/A * If a SecureRandom bit source is needed but not supplied, i.e.
0N/A * null, a default SecureRandom instance will be used.
0N/A *
0N/A * <p>If <code>genParams</code> is true, this method generates new
0N/A * p, q and g parameters. If it is false, the method uses precomputed
0N/A * parameters for the modulus length requested. If there are no
0N/A * precomputed parameters for that modulus length, an exception will be
0N/A * thrown. It is guaranteed that there will always be
0N/A * default parameters for modulus lengths of 512 and 1024 bits.
0N/A *
0N/A * @param modlen the modulus length in bits. Valid values are any
0N/A * multiple of 8 between 512 and 1024, inclusive.
0N/A *
0N/A * @param random the random bit source to use to generate key bits;
0N/A * can be null.
0N/A *
0N/A * @param genParams whether or not to generate new parameters for
0N/A * the modulus length requested.
0N/A *
0N/A * @exception InvalidParameterException if <code>modlen</code> is not
0N/A * between 512 and 1024, or if <code>genParams</code> is false and
0N/A * there are no precomputed parameters for the requested modulus
0N/A * length.
0N/A */
0N/A public void initialize(int modlen, boolean genParams, SecureRandom random)
0N/A throws InvalidParameterException;
0N/A}