* KeyAgreementSpi
*/
public void testKeyAgreementSpi01() throws InvalidKeyException,
ShortBufferException, NoSuchAlgorithmException,
InvalidAlgorithmParameterException {
KeyAgreementSpi kaSpi = new MyKeyAgreementSpi();
assertNull("Not null result", kaSpi.engineDoPhase(null, true));
try {
kaSpi.engineDoPhase(null, false);
fail("IllegalStateException must be thrown");
} catch (IllegalStateException e) {
}
byte[] bb = kaSpi.engineGenerateSecret();
assertEquals("Length is not 0", bb.length, 0);
assertEquals("Returned integer is not 0",
kaSpi.engineGenerateSecret(new byte[1], 10),
-1);
assertNull("Not null result", kaSpi.engineGenerateSecret("aaa"));
try {
kaSpi.engineGenerateSecret("");
fail("NoSuchAlgorithmException must be thrown");
} catch (NoSuchAlgorithmException e) {
}
Key key = null;
try {
kaSpi.engineInit(key, new SecureRandom());
fail("IllegalArgumentException must be thrown");
} catch (IllegalArgumentException e) {
}
AlgorithmParameterSpec params = null;
try {
kaSpi.engineInit(key, params, new SecureRandom());
fail("IllegalArgumentException must be thrown");
} catch (IllegalArgumentException e) {
}
}