DSAParameters.java revision e6bf3e8dfa2804891a82075cb469b736321b4827
1package org.bouncycastle.crypto.params;
2
3import java.math.BigInteger;
4
5import org.bouncycastle.crypto.CipherParameters;
6
7public class DSAParameters
8    implements CipherParameters
9{
10    private BigInteger              g;
11    private BigInteger              q;
12    private BigInteger              p;
13    private DSAValidationParameters validation;
14
15    public DSAParameters(
16        BigInteger  p,
17        BigInteger  q,
18        BigInteger  g)
19    {
20        this.g = g;
21        this.p = p;
22        this.q = q;
23    }
24
25    public DSAParameters(
26        BigInteger              p,
27        BigInteger              q,
28        BigInteger              g,
29        DSAValidationParameters params)
30    {
31        this.g = g;
32        this.p = p;
33        this.q = q;
34        this.validation = params;
35    }
36
37    public BigInteger getP()
38    {
39        return p;
40    }
41
42    public BigInteger getQ()
43    {
44        return q;
45    }
46
47    public BigInteger getG()
48    {
49        return g;
50    }
51
52    public DSAValidationParameters getValidationParameters()
53    {
54        return validation;
55    }
56
57    public boolean equals(
58        Object  obj)
59    {
60        if (!(obj instanceof DSAParameters))
61        {
62            return false;
63        }
64
65        DSAParameters    pm = (DSAParameters)obj;
66
67        return (pm.getP().equals(p) && pm.getQ().equals(q) && pm.getG().equals(g));
68    }
69
70    public int hashCode()
71    {
72        return getP().hashCode() ^ getQ().hashCode() ^ getG().hashCode();
73    }
74}
75