1b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallampackage org.bouncycastle.crypto.params; 2b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 3b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallamimport java.math.BigInteger; 4b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 5b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallampublic class DHPrivateKeyParameters 6b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam extends DHKeyParameters 7b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam{ 8b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam private BigInteger x; 9b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 10b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public DHPrivateKeyParameters( 11b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam BigInteger x, 12b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam DHParameters params) 13b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 14b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam super(true, params); 15b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 16b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam this.x = x; 17b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 18b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 19b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public BigInteger getX() 20b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 21b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return x; 22b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 23b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 24c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom public int hashCode() 25c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 26c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom return x.hashCode() ^ super.hashCode(); 27c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 28c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 29b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public boolean equals( 30b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam Object obj) 31b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 32b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam if (!(obj instanceof DHPrivateKeyParameters)) 33b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 34b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return false; 35b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 36b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 37c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom DHPrivateKeyParameters other = (DHPrivateKeyParameters)obj; 38b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 39c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom return other.getX().equals(this.x) && super.equals(obj); 40b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 41b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam} 42