author | juh |
Mon, 09 Sep 2013 10:52:56 -0700 | |
changeset 19828 | b4f91bc595fe |
parent 18579 | b678846778ad |
child 21334 | c60dfce46a77 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
2 |
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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 |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package java.security.interfaces; |
|
27 |
||
28 |
import java.security.*; |
|
29 |
||
30 |
/** |
|
31 |
* An interface to an object capable of generating DSA key pairs. |
|
32 |
* |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
33 |
* <p>The {@code initialize} methods may each be called any number |
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
34 |
* of times. If no {@code initialize} method is called on a |
2 | 35 |
* DSAKeyPairGenerator, the default is to generate 1024-bit keys, using |
36 |
* precomputed p, q and g parameters and an instance of SecureRandom as |
|
37 |
* the random bit source. |
|
38 |
* |
|
39 |
* <p>Users wishing to indicate DSA-specific parameters, and to generate a key |
|
40 |
* pair suitable for use with the DSA algorithm typically |
|
41 |
* |
|
42 |
* <ol> |
|
43 |
* |
|
44 |
* <li>Get a key pair generator for the DSA algorithm by calling the |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
45 |
* KeyPairGenerator {@code getInstance} method with "DSA" |
2 | 46 |
* as its argument.<p> |
47 |
* |
|
48 |
* <li>Initialize the generator by casting the result to a DSAKeyPairGenerator |
|
49 |
* and calling one of the |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
50 |
* {@code initialize} methods from this DSAKeyPairGenerator interface.<p> |
2 | 51 |
* |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
52 |
* <li>Generate a key pair by calling the {@code generateKeyPair} |
2 | 53 |
* method from the KeyPairGenerator class. |
54 |
* |
|
55 |
* </ol> |
|
56 |
* |
|
57 |
* <p>Note: it is not always necessary to do do algorithm-specific |
|
58 |
* initialization for a DSA key pair generator. That is, it is not always |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
59 |
* necessary to call an {@code initialize} method in this interface. |
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
60 |
* Algorithm-independent initialization using the {@code initialize} method |
2 | 61 |
* in the KeyPairGenerator |
62 |
* interface is all that is needed when you accept defaults for algorithm-specific |
|
63 |
* parameters. |
|
64 |
* |
|
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
5506
diff
changeset
|
65 |
* <p>Note: Some earlier implementations of this interface may not support |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
5506
diff
changeset
|
66 |
* larger sizes of DSA parameters such as 2048 and 3072-bit. |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
5506
diff
changeset
|
67 |
* |
2 | 68 |
* @see java.security.KeyPairGenerator |
69 |
*/ |
|
70 |
public interface DSAKeyPairGenerator { |
|
71 |
||
72 |
/** |
|
73 |
* Initializes the key pair generator using the DSA family parameters |
|
74 |
* (p,q and g) and an optional SecureRandom bit source. If a |
|
75 |
* SecureRandom bit source is needed but not supplied, i.e. null, a |
|
76 |
* default SecureRandom instance will be used. |
|
77 |
* |
|
78 |
* @param params the parameters to use to generate the keys. |
|
79 |
* |
|
80 |
* @param random the random bit source to use to generate key bits; |
|
81 |
* can be null. |
|
82 |
* |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
83 |
* @exception InvalidParameterException if the {@code params} |
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
5506
diff
changeset
|
84 |
* value is invalid, null, or unsupported. |
2 | 85 |
*/ |
86 |
public void initialize(DSAParams params, SecureRandom random) |
|
87 |
throws InvalidParameterException; |
|
88 |
||
89 |
/** |
|
90 |
* Initializes the key pair generator for a given modulus length |
|
91 |
* (instead of parameters), and an optional SecureRandom bit source. |
|
92 |
* If a SecureRandom bit source is needed but not supplied, i.e. |
|
93 |
* null, a default SecureRandom instance will be used. |
|
94 |
* |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
95 |
* <p>If {@code genParams} is true, this method generates new |
2 | 96 |
* p, q and g parameters. If it is false, the method uses precomputed |
97 |
* parameters for the modulus length requested. If there are no |
|
98 |
* precomputed parameters for that modulus length, an exception will be |
|
99 |
* thrown. It is guaranteed that there will always be |
|
100 |
* default parameters for modulus lengths of 512 and 1024 bits. |
|
101 |
* |
|
102 |
* @param modlen the modulus length in bits. Valid values are any |
|
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
5506
diff
changeset
|
103 |
* multiple of 64 between 512 and 1024, inclusive, 2048, and 3072. |
2 | 104 |
* |
105 |
* @param random the random bit source to use to generate key bits; |
|
106 |
* can be null. |
|
107 |
* |
|
108 |
* @param genParams whether or not to generate new parameters for |
|
109 |
* the modulus length requested. |
|
110 |
* |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
111 |
* @exception InvalidParameterException if {@code modlen} is |
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
13672
diff
changeset
|
112 |
* invalid, or unsupported, or if {@code genParams} is false and there |
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
5506
diff
changeset
|
113 |
* are no precomputed parameters for the requested modulus length. |
2 | 114 |
*/ |
115 |
public void initialize(int modlen, boolean genParams, SecureRandom random) |
|
116 |
throws InvalidParameterException; |
|
117 |
} |