Welcome to mirror list, hosted at ThFree Co, Russian Federation.

DSAParameterGenerationParameters.java « params « crypto « spongycastle « org « java « main « src « core - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8822209c5da7f5b874301fc32c56ac306ef784cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package org.spongycastle.crypto.params;

import java.security.SecureRandom;

public class DSAParameterGenerationParameters
{
    public static final int DIGITAL_SIGNATURE_USAGE = 1;
    public static final int KEY_ESTABLISHMENT_USAGE = 2;

    private final int l;
    private final int n;
    private final int usageIndex;
    private final int certainty;
    private final SecureRandom random;

    /**
     * Construct without a usage index, this will do a random construction of G.
     *
     * @param L desired length of prime P in bits (the effective key size).
     * @param N desired length of prime Q in bits.
     * @param certainty certainty level for prime number generation.
     * @param random the source of randomness to use.
     */
    public DSAParameterGenerationParameters(
        int L,
        int N,
        int certainty,
        SecureRandom random)
    {
        this(L, N, certainty, random, -1);
    }

    /**
     * Construct for a specific usage index - this has the effect of using verifiable canonical generation of G.
     *
     * @param L desired length of prime P in bits (the effective key size).
     * @param N desired length of prime Q in bits.
     * @param certainty certainty level for prime number generation.
     * @param random the source of randomness to use.
     * @param usageIndex a valid usage index.
     */
    public DSAParameterGenerationParameters(
        int L,
        int N,
        int certainty,
        SecureRandom random,
        int usageIndex)
    {
        this.l = L;
        this.n = N;
        this.certainty = certainty;
        this.usageIndex = usageIndex;
        this.random = random;
    }

    public int getL()
    {
        return l;
    }

    public int getN()
    {
        return n;
    }

    public int getCertainty()
    {
        return certainty;
    }

    public SecureRandom getRandom()
    {
        return random;
    }

    public int getUsageIndex()
    {
        return usageIndex;
    }
}