01: package org.bouncycastle.crypto.params;
02:
03: import java.math.BigInteger;
04:
05: import org.bouncycastle.crypto.CipherParameters;
06:
07: public class DSAParameters implements CipherParameters {
08: private BigInteger g;
09: private BigInteger q;
10: private BigInteger p;
11: private DSAValidationParameters validation;
12:
13: public DSAParameters(BigInteger p, BigInteger q, BigInteger g) {
14: this .g = g;
15: this .p = p;
16: this .q = q;
17: }
18:
19: public DSAParameters(BigInteger p, BigInteger q, BigInteger g,
20: DSAValidationParameters params) {
21: this .g = g;
22: this .p = p;
23: this .q = q;
24: this .validation = params;
25: }
26:
27: public BigInteger getP() {
28: return p;
29: }
30:
31: public BigInteger getQ() {
32: return q;
33: }
34:
35: public BigInteger getG() {
36: return g;
37: }
38:
39: public DSAValidationParameters getValidationParameters() {
40: return validation;
41: }
42:
43: public boolean equals(Object obj) {
44: if (!(obj instanceof DSAParameters)) {
45: return false;
46: }
47:
48: DSAParameters pm = (DSAParameters) obj;
49:
50: return (pm.getP().equals(p) && pm.getQ().equals(q) && pm.getG()
51: .equals(g));
52: }
53:
54: public int hashCode() {
55: return getP().hashCode() ^ getQ().hashCode()
56: ^ getG().hashCode();
57: }
58: }
|