Java 类org.bouncycastle.crypto.agreement.jpake.JPAKEParticipant 实例源码

项目:irma_future_id    文件:JPAKEParticipantTest.java   
private ExchangeAfterRound2Creation runExchangeUntilRound2Creation(JPAKEParticipant alice, JPAKEParticipant bob)
    throws CryptoException
{
    JPAKERound1Payload aliceRound1Payload = alice.createRound1PayloadToSend();
    JPAKERound1Payload bobRound1Payload = bob.createRound1PayloadToSend();

    alice.validateRound1PayloadReceived(bobRound1Payload);
    bob.validateRound1PayloadReceived(aliceRound1Payload);

    JPAKERound2Payload aliceRound2Payload = alice.createRound2PayloadToSend();
    JPAKERound2Payload bobRound2Payload = bob.createRound2PayloadToSend();

    return new ExchangeAfterRound2Creation(
        alice,
        aliceRound2Payload,
        bobRound2Payload);
}
项目:bc-java    文件:JPAKEParticipantTest.java   
private ExchangeAfterRound2Creation runExchangeUntilRound2Creation(JPAKEParticipant alice, JPAKEParticipant bob)
    throws CryptoException
{
    JPAKERound1Payload aliceRound1Payload = alice.createRound1PayloadToSend();
    JPAKERound1Payload bobRound1Payload = bob.createRound1PayloadToSend();

    alice.validateRound1PayloadReceived(bobRound1Payload);
    bob.validateRound1PayloadReceived(aliceRound1Payload);

    JPAKERound2Payload aliceRound2Payload = alice.createRound2PayloadToSend();
    JPAKERound2Payload bobRound2Payload = bob.createRound2PayloadToSend();

    return new ExchangeAfterRound2Creation(
        alice,
        aliceRound2Payload,
        bobRound2Payload);
}
项目:irma_future_id    文件:JPAKEParticipantTest.java   
public ExchangeAfterRound2Creation(
    JPAKEParticipant alice,
    JPAKERound2Payload aliceRound2Payload,
    JPAKERound2Payload bobRound2Payload)
{
    this.alice = alice;
    this.aliceRound2Payload = aliceRound2Payload;
    this.bobRound2Payload = bobRound2Payload;
}
项目:irma_future_id    文件:JPAKEParticipantTest.java   
private JPAKEParticipant createParticipant(String participantId, String password)
{
    return new JPAKEParticipant(
        participantId,
        password.toCharArray(),
        JPAKEPrimeOrderGroups.SUN_JCE_1024);
}
项目:bc-java    文件:JPAKEParticipantTest.java   
public ExchangeAfterRound2Creation(
    JPAKEParticipant alice,
    JPAKERound2Payload aliceRound2Payload,
    JPAKERound2Payload bobRound2Payload)
{
    this.alice = alice;
    this.aliceRound2Payload = aliceRound2Payload;
    this.bobRound2Payload = bobRound2Payload;
}
项目:bc-java    文件:JPAKEParticipantTest.java   
private JPAKEParticipant createParticipant(String participantId, String password)
{
    return new JPAKEParticipant(
        participantId,
        password.toCharArray(),
        JPAKEPrimeOrderGroups.SUN_JCE_1024);
}
项目:irma_future_id    文件:JPAKEParticipantTest.java   
public void testSuccessfulExchange()
    throws CryptoException
{

    JPAKEParticipant alice = createAlice();
    JPAKEParticipant bob = createBob();

    ExchangeAfterRound2Creation exchange = runExchangeUntilRound2Creation(alice, bob);

    alice.validateRound2PayloadReceived(exchange.bobRound2Payload);
    bob.validateRound2PayloadReceived(exchange.aliceRound2Payload);

    BigInteger aliceKeyingMaterial = alice.calculateKeyingMaterial();
    BigInteger bobKeyingMaterial = bob.calculateKeyingMaterial();

    JPAKERound3Payload aliceRound3Payload = alice.createRound3PayloadToSend(aliceKeyingMaterial);
    JPAKERound3Payload bobRound3Payload = bob.createRound3PayloadToSend(bobKeyingMaterial);

    alice.validateRound3PayloadReceived(bobRound3Payload, aliceKeyingMaterial);
    bob.validateRound3PayloadReceived(aliceRound3Payload, bobKeyingMaterial);

    assertEquals(aliceKeyingMaterial, bobKeyingMaterial);

}
项目:irma_future_id    文件:JPAKEParticipantTest.java   
private JPAKEParticipant createAlice()
{
    return createParticipant("alice", "password");
}
项目:irma_future_id    文件:JPAKEParticipantTest.java   
private JPAKEParticipant createBob()
{
    return createParticipant("bob", "password");
}
项目:irma_future_id    文件:JPAKEParticipantTest.java   
private JPAKEParticipant createBobWithWrongPassword()
{
    return createParticipant("bob", "wrong");
}
项目:bc-java    文件:JPAKEParticipantTest.java   
public void testSuccessfulExchange()
    throws CryptoException
{

    JPAKEParticipant alice = createAlice();
    JPAKEParticipant bob = createBob();

    ExchangeAfterRound2Creation exchange = runExchangeUntilRound2Creation(alice, bob);

    alice.validateRound2PayloadReceived(exchange.bobRound2Payload);
    bob.validateRound2PayloadReceived(exchange.aliceRound2Payload);

    BigInteger aliceKeyingMaterial = alice.calculateKeyingMaterial();
    BigInteger bobKeyingMaterial = bob.calculateKeyingMaterial();

    JPAKERound3Payload aliceRound3Payload = alice.createRound3PayloadToSend(aliceKeyingMaterial);
    JPAKERound3Payload bobRound3Payload = bob.createRound3PayloadToSend(bobKeyingMaterial);

    alice.validateRound3PayloadReceived(bobRound3Payload, aliceKeyingMaterial);
    bob.validateRound3PayloadReceived(aliceRound3Payload, bobKeyingMaterial);

    assertEquals(aliceKeyingMaterial, bobKeyingMaterial);

}
项目:bc-java    文件:JPAKEParticipantTest.java   
private JPAKEParticipant createAlice()
{
    return createParticipant("alice", "password");
}
项目:bc-java    文件:JPAKEParticipantTest.java   
private JPAKEParticipant createBob()
{
    return createParticipant("bob", "password");
}
项目:bc-java    文件:JPAKEParticipantTest.java   
private JPAKEParticipant createBobWithWrongPassword()
{
    return createParticipant("bob", "wrong");
}