01: package org.bouncycastle.crypto.params;
02:
03: public class DHKeyParameters extends AsymmetricKeyParameter {
04: private DHParameters params;
05:
06: protected DHKeyParameters(boolean isPrivate, DHParameters params) {
07: super (isPrivate);
08:
09: this .params = params;
10: }
11:
12: public DHParameters getParameters() {
13: return params;
14: }
15:
16: public boolean equals(Object obj) {
17: if (!(obj instanceof DHKeyParameters)) {
18: return false;
19: }
20:
21: DHKeyParameters dhKey = (DHKeyParameters) obj;
22:
23: if (params == null) {
24: return dhKey.getParameters() == null;
25: } else {
26: return params.equals(dhKey.getParameters());
27: }
28: }
29:
30: public int hashCode() {
31: int code = isPrivate() ? 0 : 1;
32:
33: if (params != null) {
34: code ^= params.hashCode();
35: }
36:
37: return code;
38: }
39: }
|