1 |
/* AlgorithmParametersSpi.java --- Algorithm Parameters SPI |
/* AlgorithmParametersSpi.java --- Algorithm Parameters SPI |
2 |
Copyright (C) 1999 Free Software Foundation, Inc. |
Copyright (C) 1999, 2004 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
|
|
39 |
package java.security; |
package java.security; |
40 |
import java.security.spec.InvalidParameterSpecException; |
|
|
import java.security.spec.AlgorithmParameterSpec; |
|
41 |
import java.io.IOException; |
import java.io.IOException; |
42 |
|
import java.security.spec.AlgorithmParameterSpec; |
43 |
|
import java.security.spec.InvalidParameterSpecException; |
44 |
|
|
45 |
/** |
/** |
46 |
AlgorithmParametersSpi is the Service Provider Interface |
* AlgorithmParametersSpi is the Service Provider Interface |
47 |
for the Algorithm Parameters class. This class is used |
* for the Algorithm Parameters class. This class is used |
48 |
to manage the algorithm parameters. |
* to manage the algorithm parameters. |
49 |
|
* |
50 |
@since JDK 1.2 |
* @since 1.2 |
51 |
@author Mark Benvenuto |
* @author Mark Benvenuto |
52 |
*/ |
*/ |
53 |
public abstract class AlgorithmParametersSpi |
public abstract class AlgorithmParametersSpi |
54 |
{ |
{ |
55 |
/** |
/** |
56 |
Creates a new instance of AlgorithmParametersSpi |
* Creates a new instance of AlgorithmParametersSpi |
57 |
*/ |
*/ |
58 |
public AlgorithmParametersSpi() |
public AlgorithmParametersSpi() |
59 |
{ |
{ |
60 |
} |
} |
61 |
|
|
62 |
/** |
/** |
63 |
Initializes the engine with the specified |
* Initializes the engine with the specified |
64 |
AlgorithmParameterSpec class. |
* AlgorithmParameterSpec class. |
65 |
|
* |
66 |
@param paramSpec A AlgorithmParameterSpec to initialize with |
* @param paramSpec A AlgorithmParameterSpec to initialize with |
67 |
|
* |
68 |
@throws InvalidParameterSpecException For an inapporiate ParameterSpec class |
* @throws InvalidParameterSpecException For an inapporiate |
69 |
|
* ParameterSpec class |
70 |
*/ |
*/ |
71 |
protected abstract void engineInit(AlgorithmParameterSpec paramSpec) throws |
protected abstract void engineInit(AlgorithmParameterSpec paramSpec) |
72 |
InvalidParameterSpecException; |
throws InvalidParameterSpecException; |
73 |
|
|
74 |
/** |
/** |
75 |
Initializes the engine with the specified |
* Initializes the engine with the specified |
76 |
parameters stored in the byte array and decodes them |
* parameters stored in the byte array and decodes them |
77 |
according to the ASN.1 specification. If the ASN.1 |
* according to the ASN.1 specification. If the ASN.1 |
78 |
specification exists then it succeeds or else it throws |
* specification exists then it succeeds or else it throws |
79 |
IOException. |
* IOException. |
80 |
|
* |
81 |
@param params Parameters to initialize with |
* @param params Parameters to initialize with |
82 |
|
* |
83 |
@throws IOException Decoding Error |
* @throws IOException Decoding Error |
84 |
*/ |
*/ |
85 |
protected abstract void engineInit(byte[]params) throws IOException; |
protected abstract void engineInit(byte[]params) throws IOException; |
86 |
|
|
87 |
/** |
/** |
88 |
Initializes the engine with the specified |
* Initializes the engine with the specified |
89 |
parameters stored in the byte array and decodes them |
* parameters stored in the byte array and decodes them |
90 |
according to the specified decoding specification. |
* according to the specified decoding specification. |
91 |
If format is null, then it is decoded using the ASN.1 |
* If format is null, then it is decoded using the ASN.1 |
92 |
specification if it exists or else it throws |
* specification if it exists or else it throws |
93 |
IOException. |
* IOException. |
94 |
|
* |
95 |
@param params Parameters to initialize with |
* @param params Parameters to initialize with |
96 |
@param format Name of decoding format to use |
* @param format Name of decoding format to use |
97 |
|
* |
98 |
@throws IOException Decoding Error |
* @throws IOException Decoding Error |
99 |
*/ |
*/ |
100 |
protected abstract void engineInit(byte[]params, |
protected abstract void engineInit(byte[]params, String format) |
101 |
String format) throws IOException; |
throws IOException; |
102 |
|
|
103 |
|
|
104 |
/** |
/** |
105 |
Returns a specification of this AlgorithmParameters object. |
* Returns a specification of this AlgorithmParameters object. |
106 |
paramSpec identifies the class to return the AlgortihmParameters |
* paramSpec identifies the class to return the AlgortihmParameters |
107 |
in. |
* in. |
108 |
|
* |
109 |
@param paramSpec Class to return AlgorithmParameters in |
* @param paramSpec Class to return AlgorithmParameters in |
110 |
|
* |
111 |
@return the parameter specification |
* @return the parameter specification |
112 |
|
* |
113 |
@throws InvalidParameterSpecException if the paramSpec is an invalid parameter class |
* @throws InvalidParameterSpecException if the paramSpec is an |
114 |
|
* invalid parameter class |
115 |
*/ |
*/ |
116 |
protected abstract AlgorithmParameterSpec engineGetParameterSpec(Class |
protected abstract AlgorithmParameterSpec engineGetParameterSpec(Class |
117 |
paramSpec) |
paramSpec) |
119 |
|
|
120 |
|
|
121 |
/** |
/** |
122 |
Returns the parameters in the default encoding format. |
* Returns the parameters in the default encoding format. |
123 |
The primary encoding format is ASN.1 format if it exists |
* The primary encoding format is ASN.1 format if it exists |
124 |
for the specified type. |
* for the specified type. |
125 |
|
* |
126 |
@return byte array representing the parameters |
* @return byte array representing the parameters |
127 |
*/ |
*/ |
128 |
protected abstract byte[] engineGetEncoded() throws IOException; |
protected abstract byte[] engineGetEncoded() throws IOException; |
129 |
|
|
130 |
|
|
131 |
/** |
/** |
132 |
Returns the parameters in the specified encoding format. |
* Returns the parameters in the specified encoding format. |
133 |
If <code>format</code> is <code>null</code> then the |
* If <code>format</code> is <code>null</code> then the |
134 |
primary encoding format is used, the ASN.1 format, |
* primary encoding format is used, the ASN.1 format, |
135 |
if it exists for the specified type. |
* if it exists for the specified type. |
136 |
|
* |
137 |
@return byte array representing the parameters |
* @return byte array representing the parameters |
138 |
*/ |
*/ |
139 |
protected abstract byte[] engineGetEncoded(String format) throws |
protected abstract byte[] engineGetEncoded(String format) |
140 |
IOException; |
throws IOException; |
141 |
|
|
142 |
/** |
/** |
143 |
Returns a string describing the parameters in the |
* Returns a string describing the parameters in the |
144 |
AlgorithmParametersSpi class. |
* AlgorithmParametersSpi class. |
145 |
|
* |
146 |
@return A string representing the format of the parameters. |
* @return A string representing the format of the parameters. |
147 |
*/ |
*/ |
148 |
protected abstract String engineToString(); |
protected abstract String engineToString(); |
149 |
} |
} |