KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > security > AlgorithmParameterGeneratorSpi


1 /*
2  * @(#)AlgorithmParameterGeneratorSpi.java 1.14 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.security;
9
10 import java.security.spec.AlgorithmParameterSpec JavaDoc;
11
12 /**
13  * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
14  * for the <code>AlgorithmParameterGenerator</code> class, which
15  * is used to generate a set of parameters to be used with a certain algorithm.
16  *
17  * <p> All the abstract methods in this class must be implemented by each
18  * cryptographic service provider who wishes to supply the implementation
19  * of a parameter generator for a particular algorithm.
20  *
21  * <p> In case the client does not explicitly initialize the
22  * AlgorithmParameterGenerator (via a call to an <code>engineInit</code>
23  * method), each provider must supply (and document) a default initialization.
24  * For example, the Sun provider uses a default modulus prime size of 1024
25  * bits for the generation of DSA parameters.
26  *
27  * @author Jan Luehe
28  *
29  * @version 1.14, 12/19/03
30  *
31  * @see AlgorithmParameterGenerator
32  * @see AlgorithmParameters
33  * @see java.security.spec.AlgorithmParameterSpec
34  *
35  * @since 1.2
36  */

37
38 public abstract class AlgorithmParameterGeneratorSpi {
39
40     /**
41      * Initializes this parameter generator for a certain size
42      * and source of randomness.
43      *
44      * @param size the size (number of bits).
45      * @param random the source of randomness.
46      */

47     protected abstract void engineInit(int size, SecureRandom JavaDoc random);
48
49     /**
50      * Initializes this parameter generator with a set of
51      * algorithm-specific parameter generation values.
52      *
53      * @param genParamSpec the set of algorithm-specific parameter generation values.
54      * @param random the source of randomness.
55      *
56      * @exception InvalidAlgorithmParameterException if the given parameter
57      * generation values are inappropriate for this parameter generator.
58      */

59     protected abstract void engineInit(AlgorithmParameterSpec JavaDoc genParamSpec,
60                        SecureRandom JavaDoc random)
61     throws InvalidAlgorithmParameterException JavaDoc;
62
63     /**
64      * Generates the parameters.
65      *
66      * @return the new AlgorithmParameters object.
67      */

68     protected abstract AlgorithmParameters JavaDoc engineGenerateParameters();
69 }
70
Popular Tags