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 * 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 * 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 * 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. 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 0N/A * pairs according to the DSS standard NIST FIPS 186. It uses the 0N/A * updated version of SHA, SHA-1 as described in FIPS 180-1. 0N/A * @author Benjamin Renaud 0N/A * @author Andreas Sterbenz 0N/A /* The modulus length */ 0N/A /* whether to force new parameters to be generated for each KeyPair */ 0N/A /* preset algorithm parameters. */ 0N/A /* The source of random bits to use */ 0N/A (
"Modulus size must range from 512 to 1024 " 0N/A +
"and be a multiple of 64");
0N/A * Initializes the DSA key pair generator. If <code>genParams</code> 0N/A * is false, a set of pre-computed parameters is used. 0N/A (
"No precomputed parameters for requested modulus size " 0N/A * Initializes the DSA object using a DSA parameter object. 0N/A * @param params a fully initialized DSA parameter object. 0N/A * Initializes the DSA object using a parameter object. 0N/A * @param params the parameter set to be used to generate 0N/A * @param random the source of randomness for this generator. 0N/A * @exception InvalidAlgorithmParameterException if the given parameters 0N/A * are inappropriate for this key pair generator 0N/A (
"Inappropriate parameter");
0N/A * Generates a pair of keys usable by any JavaSecurity compliant 0N/A * DSA implementation. 0N/A // generate new parameters each time 0N/A // See the comments in DSAKeyFactory, 4532506, and 6232513. 0N/A * Generate the private key component of the key pair using the 0N/A * provided source of random bits. This method uses the random but 0N/A * source passed to generate a seed and then calls the seed-based 0N/A for (
int i =
0; i <
5; i++) {
0N/A * Given a seed, generate the private key component of the key 0N/A * pair. In the terminology used in the DSA specification 0N/A * (FIPS-186) seed is the XSEED quantity. 0N/A * @param seed the seed to use to generate the private key. 0N/A // check out t in the spec. 0N/A int[] t = {
0x67452301,
0xEFCDAB89,
0x98BADCFE,
0N/A 0x10325476,
0xC3D2E1F0 };
0N/A for (
int j =
0; j <
4; j++) {
0N/A * Generate the public key component y of the key pair. 0N/A * @param x the private key component. 0N/A * @param p the base parameter.