summaryrefslogtreecommitdiffstats
path: root/bcprov/src/main/java/org/bouncycastle/crypto/params/CramerShoupPublicKeyParameters.java
blob: 341149c1455f750fde43ee39c5fec3ee80ef73c9 (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
package org.bouncycastle.crypto.params;

import java.math.BigInteger;

public class CramerShoupPublicKeyParameters extends CramerShoupKeyParameters {
	
	private BigInteger c, d, h; // public key group elements

	public CramerShoupPublicKeyParameters(CramerShoupParameters params, BigInteger c, BigInteger d, BigInteger h) {
		super(false, params);

		this.c = c;
		this.d = d;
		this.h = h;
	}

	public BigInteger getC() {
		return c;
	}
	
	public BigInteger getD() {
		return d;
	}
	
	public BigInteger getH() {
		return h;
	}

	public int hashCode() {
		return c.hashCode() ^ d.hashCode() ^ h.hashCode() ^ super.hashCode();
	}

	public boolean equals(Object obj) {
		if (!(obj instanceof CramerShoupPublicKeyParameters)) {
			return false;
		}

		CramerShoupPublicKeyParameters other = (CramerShoupPublicKeyParameters) obj;

		return other.getC().equals(c) && other.getD().equals(d) && other.getH().equals(h) && super.equals(obj);
	}
}