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
68 *
69 * <p>Note: Some earlier implementations of this interface may not support
70 * larger values of DSA parameters such as 3072-bit.
71 *
72 * @since 1.1
73 * @see java.security.KeyPairGenerator
74 */
75 public interface DSAKeyPairGenerator {
76
77 /**
78 * Initializes the key pair generator using the DSA family parameters
79 * (p,q and g) and an optional SecureRandom bit source. If a
80 * SecureRandom bit source is needed but not supplied, i.e. null, a
81 * default SecureRandom instance will be used.
82 *
83 * @param params the parameters to use to generate the keys.
84 *
85 * @param random the random bit source to use to generate key bits;
86 * can be null.
87 *
88 * @exception InvalidParameterException if the {@code params}
89 * value is invalid, null, or unsupported.
90 */
91 public void initialize(DSAParams params, SecureRandom random)
92 throws InvalidParameterException;
93
94 /**
95 * Initializes the key pair generator for a given modulus length
96 * (instead of parameters), and an optional SecureRandom bit source.
97 * If a SecureRandom bit source is needed but not supplied, i.e.
98 * null, a default SecureRandom instance will be used.
99 *
100 * <p>If {@code genParams} is true, this method generates new
101 * p, q and g parameters. If it is false, the method uses precomputed
102 * parameters for the modulus length requested. If there are no
103 * precomputed parameters for that modulus length, an exception will be
104 * thrown.
105 *
106 * @param modlen the modulus length in bits. Valid values are any
107 * multiple of 64 between 512 and 1024, inclusive, 2048, and 3072.
108 *
109 * @param random the random bit source to use to generate key bits;
110 * can be null.
111 *
112 * @param genParams whether or not to generate new parameters for
113 * the modulus length requested.
114 *
115 * @exception InvalidParameterException if {@code modlen} is
116 * invalid, or unsupported, or if {@code genParams} is false and there
117 * are no precomputed parameters for the requested modulus length.
118 */
119 public void initialize(int modlen, boolean genParams, SecureRandom random)
120 throws InvalidParameterException;
121 }
|
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
68 *
69 * <p>Note: Some earlier implementations of this interface may not support
70 * larger values of DSA parameters such as 3072-bit.
71 *
72 * @since 1.1
73 * @see java.security.KeyPairGenerator
74 */
75 public interface DSAKeyPairGenerator {
76
77 /**
78 * Initializes the key pair generator using the DSA family parameters
79 * (p,q and g) and an optional SecureRandom bit source. If a
80 * SecureRandom bit source is needed but not supplied, i.e. null, a
81 * default SecureRandom instance will be used.
82 *
83 * @param params the parameters to use to generate the keys.
84 *
85 * @param random the random bit source to use to generate key bits;
86 * can be null.
87 *
88 * @throws InvalidParameterException if the {@code params}
89 * value is invalid, null, or unsupported.
90 */
91 public void initialize(DSAParams params, SecureRandom random)
92 throws InvalidParameterException;
93
94 /**
95 * Initializes the key pair generator for a given modulus length
96 * (instead of parameters), and an optional SecureRandom bit source.
97 * If a SecureRandom bit source is needed but not supplied, i.e.
98 * null, a default SecureRandom instance will be used.
99 *
100 * <p>If {@code genParams} is true, this method generates new
101 * p, q and g parameters. If it is false, the method uses precomputed
102 * parameters for the modulus length requested. If there are no
103 * precomputed parameters for that modulus length, an exception will be
104 * thrown.
105 *
106 * @param modlen the modulus length in bits. Valid values are any
107 * multiple of 64 between 512 and 1024, inclusive, 2048, and 3072.
108 *
109 * @param random the random bit source to use to generate key bits;
110 * can be null.
111 *
112 * @param genParams whether or not to generate new parameters for
113 * the modulus length requested.
114 *
115 * @throws InvalidParameterException if {@code modlen} is
116 * invalid, or unsupported, or if {@code genParams} is false and there
117 * are no precomputed parameters for the requested modulus length.
118 */
119 public void initialize(int modlen, boolean genParams, SecureRandom random)
120 throws InvalidParameterException;
121 }
|