harness.fail("while Client (A) is in step #1");
}
harness.check(!A.isComplete(), "Client (A) is OK after step #1");
// (2) host receives user identity, and generates its own public key
IncomingMessage in = null;
try
{
in = new IncomingMessage(out.toByteArray());
}
catch (KeyAgreementException x)
{
harness.debug(x);
harness.fail("while feeding Server (B), Client's (A) incoming message");
}
out = null;
try
{
out = B.processMessage(in);
}
catch (KeyAgreementException x)
{
harness.debug(x);
harness.fail("while Server (B) is in step #1");
}
harness.check(!B.isComplete(), "Server (B) is OK after step #1");
// (3) A computes the shared secret
in = null;
try
{
in = new IncomingMessage(out.toByteArray());
}
catch (KeyAgreementException x)
{
harness.debug(x);
harness.fail("while feeding Client (A), Server's (B) incoming message");
}
out = null;
try
{
out = A.processMessage(in);
}
catch (KeyAgreementException x)
{
harness.debug(x);
harness.fail("while User (A) is in step #2");
}
harness.check(A.isComplete(), "Client (A) is complete after step #2");
byte[] k1 = null;
try
{
k1 = A.getSharedSecret();
}
catch (KeyAgreementException x)
{
harness.fail("while accessing Client's (A) version of the shared secret");
}
// (4) B computes the shared secret
in = null;
try
{
in = new IncomingMessage(out.toByteArray());
}
catch (KeyAgreementException x)
{
harness.debug(x);
harness.fail("while feeding Server (B), Client's (A) incoming message");