1 17 18 package org.apache.geronimo.util.crypto.params; 19 20 import java.math.BigInteger ; 21 22 import org.apache.geronimo.util.crypto.CipherParameters; 23 24 public class DHParameters 25 implements CipherParameters 26 { 27 private BigInteger g; 28 private BigInteger p; 29 private BigInteger q; 30 private int j; 31 private DHValidationParameters validation; 32 33 public DHParameters( 34 BigInteger p, 35 BigInteger g) 36 { 37 this.g = g; 38 this.p = p; 39 } 40 41 public DHParameters( 42 BigInteger p, 43 BigInteger g, 44 BigInteger q, 45 int j) 46 { 47 this.g = g; 48 this.p = p; 49 this.q = q; 50 this.j = j; 51 } 52 53 public DHParameters( 54 BigInteger p, 55 BigInteger g, 56 BigInteger q, 57 int j, 58 DHValidationParameters validation) 59 { 60 this.g = g; 61 this.p = p; 62 this.q = q; 63 this.j = j; 64 } 65 66 public BigInteger getP() 67 { 68 return p; 69 } 70 71 public BigInteger getG() 72 { 73 return g; 74 } 75 76 public BigInteger getQ() 77 { 78 return q; 79 } 80 81 86 public int getJ() 87 { 88 return j; 89 } 90 91 public DHValidationParameters getValidationParameters() 92 { 93 return validation; 94 } 95 96 public boolean equals( 97 Object obj) 98 { 99 if (!(obj instanceof DHParameters)) 100 { 101 return false; 102 } 103 104 DHParameters pm = (DHParameters)obj; 105 106 if (this.getValidationParameters() != null) 107 { 108 if (!this.getValidationParameters().equals(pm.getValidationParameters())) 109 { 110 return false; 111 } 112 } 113 else 114 { 115 if (pm.getValidationParameters() != null) 116 { 117 return false; 118 } 119 } 120 121 if (this.getQ() != null) 122 { 123 if (!this.getQ().equals(pm.getQ())) 124 { 125 return false; 126 } 127 } 128 else 129 { 130 if (pm.getQ() != null) 131 { 132 return false; 133 } 134 } 135 136 return (j == pm.getJ()) && pm.getP().equals(p) && pm.getG().equals(g); 137 } 138 } 139 | Popular Tags |