1package org.bouncycastle.crypto.params;
2
3import java.security.SecureRandom;
4
5public class DSAParameterGenerationParameters
6{
7    public static final int DIGITAL_SIGNATURE_USAGE = 1;
8    public static final int KEY_ESTABLISHMENT_USAGE = 2;
9
10    private final int l;
11    private final int n;
12    private final int usageIndex;
13    private final int certainty;
14    private final SecureRandom random;
15
16    /**
17     * Construct without a usage index, this will do a random construction of G.
18     *
19     * @param L desired length of prime P in bits (the effective key size).
20     * @param N desired length of prime Q in bits.
21     * @param certainty certainty level for prime number generation.
22     * @param random the source of randomness to use.
23     */
24    public DSAParameterGenerationParameters(
25        int L,
26        int N,
27        int certainty,
28        SecureRandom random)
29    {
30        this(L, N, certainty, random, -1);
31    }
32
33    /**
34     * Construct for a specific usage index - this has the effect of using verifiable canonical generation of G.
35     *
36     * @param L desired length of prime P in bits (the effective key size).
37     * @param N desired length of prime Q in bits.
38     * @param certainty certainty level for prime number generation.
39     * @param random the source of randomness to use.
40     * @param usageIndex a valid usage index.
41     */
42    public DSAParameterGenerationParameters(
43        int L,
44        int N,
45        int certainty,
46        SecureRandom random,
47        int usageIndex)
48    {
49        this.l = L;
50        this.n = N;
51        this.certainty = certainty;
52        this.usageIndex = usageIndex;
53        this.random = random;
54    }
55
56    public int getL()
57    {
58        return l;
59    }
60
61    public int getN()
62    {
63        return n;
64    }
65
66    public int getCertainty()
67    {
68        return certainty;
69    }
70
71    public SecureRandom getRandom()
72    {
73        return random;
74    }
75
76    public int getUsageIndex()
77    {
78        return usageIndex;
79    }
80}
81