use of javax.crypto.spec.DHPrivateKeySpec in project j2objc by google.
the class DHPrivateKeySpecTest method testDHPrivateKeySpec.
/**
* DHPrivateKeySpec class testing. Tests the equivalence of parameters
* specified in the constructor with the values returned by getters.
*/
public void testDHPrivateKeySpec() {
BigInteger[] xs = { new BigInteger("-1000000000000"), BigInteger.ZERO, BigInteger.ONE, new BigInteger("1000000000000") };
BigInteger[] ps = { new BigInteger("-1000000000000"), BigInteger.ZERO, BigInteger.ONE, new BigInteger("1000000000000") };
BigInteger[] gs = { new BigInteger("-1000000000000"), BigInteger.ZERO, BigInteger.ONE, new BigInteger("1000000000000") };
for (int i = 0; i < ps.length; i++) {
DHPrivateKeySpec dhpks = new DHPrivateKeySpec(xs[i], ps[i], gs[i]);
assertEquals("The value returned by getX() must be " + "equal to the value specified in the constructor", dhpks.getX(), xs[i]);
assertEquals("The value returned by getP() must be " + "equal to the value specified in the constructor", dhpks.getP(), ps[i]);
assertEquals("The value returned by getG() must be " + "equal to the value specified in the constructor", dhpks.getG(), gs[i]);
}
}
Aggregations