01: package org.bouncycastle.jce.provider;
02:
03: import org.bouncycastle.asn1.DEROctetString;
04:
05: import java.io.IOException;
06: import java.security.AlgorithmParametersSpi;
07: import java.security.spec.AlgorithmParameterSpec;
08: import java.security.spec.InvalidParameterSpecException;
09:
10: public abstract class JDKECDSAAlgParameters extends
11: AlgorithmParametersSpi {
12: public static class SigAlgParameters extends JDKAlgorithmParameters {
13: protected byte[] engineGetEncoded() throws IOException {
14: return engineGetEncoded("ASN.1");
15: }
16:
17: protected byte[] engineGetEncoded(String format)
18: throws IOException {
19: if (format == null) {
20: return engineGetEncoded("ASN.1");
21: }
22:
23: if (format.equals("ASN.1")) {
24: return new DEROctetString(engineGetEncoded("RAW"))
25: .getEncoded();
26: }
27:
28: return null;
29: }
30:
31: protected AlgorithmParameterSpec localEngineGetParameterSpec(
32: Class paramSpec) throws InvalidParameterSpecException {
33: throw new InvalidParameterSpecException(
34: "unknown parameter spec passed to ECDSA parameters object.");
35: }
36:
37: protected void engineInit(AlgorithmParameterSpec paramSpec)
38: throws InvalidParameterSpecException {
39: throw new InvalidParameterSpecException(
40: "unknown parameter spec passed to ECDSA parameters object.");
41: }
42:
43: protected void engineInit(byte[] params) throws IOException {
44: }
45:
46: protected void engineInit(byte[] params, String format)
47: throws IOException {
48: throw new IOException(
49: "Unknown parameters format in IV parameters object");
50: }
51:
52: protected String engineToString() {
53: return "ECDSA Parameters";
54: }
55: }
56: }
|