author | valeriep |
Thu, 01 Jun 2017 03:26:30 +0000 | |
changeset 45435 | 7a91c865edd4 |
parent 25859 | 3317bb8137f4 |
child 45665 | 6f21cd7ec80e |
permissions | -rw-r--r-- |
2 | 1 |
/* |
45435
7a91c865edd4
8180635: (doc) Clarify the compatibility and interoperability issue when using provider default values
valeriep
parents:
25859
diff
changeset
|
2 |
* Copyright (c) 1997, 2017, 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; |
|
27 |
||
28 |
import java.security.spec.AlgorithmParameterSpec; |
|
29 |
||
30 |
/** |
|
31 |
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
32 |
* for the {@code AlgorithmParameterGenerator} class, which |
2 | 33 |
* is used to generate a set of parameters to be used with a certain algorithm. |
34 |
* |
|
35 |
* <p> All the abstract methods in this class must be implemented by each |
|
36 |
* cryptographic service provider who wishes to supply the implementation |
|
37 |
* of a parameter generator for a particular algorithm. |
|
38 |
* |
|
39 |
* <p> In case the client does not explicitly initialize the |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
40 |
* AlgorithmParameterGenerator (via a call to an {@code engineInit} |
2 | 41 |
* method), each provider must supply (and document) a default initialization. |
45435
7a91c865edd4
8180635: (doc) Clarify the compatibility and interoperability issue when using provider default values
valeriep
parents:
25859
diff
changeset
|
42 |
* See the Keysize Restriction sections of the |
7a91c865edd4
8180635: (doc) Clarify the compatibility and interoperability issue when using provider default values
valeriep
parents:
25859
diff
changeset
|
43 |
* <a href="{@docRoot}/../technotes/guides/security/SunProviders.html"> |
7a91c865edd4
8180635: (doc) Clarify the compatibility and interoperability issue when using provider default values
valeriep
parents:
25859
diff
changeset
|
44 |
* JDK Providers</a> |
7a91c865edd4
8180635: (doc) Clarify the compatibility and interoperability issue when using provider default values
valeriep
parents:
25859
diff
changeset
|
45 |
* document for information on the AlgorithmParameterGenerator defaults |
7a91c865edd4
8180635: (doc) Clarify the compatibility and interoperability issue when using provider default values
valeriep
parents:
25859
diff
changeset
|
46 |
* used by JDK providers. |
7a91c865edd4
8180635: (doc) Clarify the compatibility and interoperability issue when using provider default values
valeriep
parents:
25859
diff
changeset
|
47 |
* However, note that defaults may vary across different providers. |
7a91c865edd4
8180635: (doc) Clarify the compatibility and interoperability issue when using provider default values
valeriep
parents:
25859
diff
changeset
|
48 |
* Additionally, the default value for a provider may change in a future |
7a91c865edd4
8180635: (doc) Clarify the compatibility and interoperability issue when using provider default values
valeriep
parents:
25859
diff
changeset
|
49 |
* version. Therefore, it is recommended to explicitly initialize the |
7a91c865edd4
8180635: (doc) Clarify the compatibility and interoperability issue when using provider default values
valeriep
parents:
25859
diff
changeset
|
50 |
* AlgorithmParameterGenerator instead of relying on provider-specific defaults. |
2 | 51 |
* |
52 |
* @author Jan Luehe |
|
53 |
* |
|
54 |
* |
|
55 |
* @see AlgorithmParameterGenerator |
|
56 |
* @see AlgorithmParameters |
|
57 |
* @see java.security.spec.AlgorithmParameterSpec |
|
58 |
* |
|
59 |
* @since 1.2 |
|
60 |
*/ |
|
61 |
||
62 |
public abstract class AlgorithmParameterGeneratorSpi { |
|
63 |
||
64 |
/** |
|
65 |
* Initializes this parameter generator for a certain size |
|
66 |
* and source of randomness. |
|
67 |
* |
|
68 |
* @param size the size (number of bits). |
|
69 |
* @param random the source of randomness. |
|
70 |
*/ |
|
71 |
protected abstract void engineInit(int size, SecureRandom random); |
|
72 |
||
73 |
/** |
|
74 |
* Initializes this parameter generator with a set of |
|
75 |
* algorithm-specific parameter generation values. |
|
76 |
* |
|
77 |
* @param genParamSpec the set of algorithm-specific parameter generation values. |
|
78 |
* @param random the source of randomness. |
|
79 |
* |
|
80 |
* @exception InvalidAlgorithmParameterException if the given parameter |
|
81 |
* generation values are inappropriate for this parameter generator. |
|
82 |
*/ |
|
83 |
protected abstract void engineInit(AlgorithmParameterSpec genParamSpec, |
|
84 |
SecureRandom random) |
|
85 |
throws InvalidAlgorithmParameterException; |
|
86 |
||
87 |
/** |
|
88 |
* Generates the parameters. |
|
89 |
* |
|
90 |
* @return the new AlgorithmParameters object. |
|
91 |
*/ |
|
92 |
protected abstract AlgorithmParameters engineGenerateParameters(); |
|
93 |
} |