diff options
author | David Hook <dgh@cryptoworkshop.com> | 2013-05-31 11:07:45 +0400 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2013-05-31 11:07:45 +0400 |
commit | 2b976f5364cfdbc37d3086019d93483c983eb80b (patch) | |
tree | cb846af3fd1d43f9c2562a1fb2d06b997ad8f229 /core/src/main/java/org/bouncycastle/crypto/agreement/jpake/JPAKERound2Payload.java | |
parent | 5f714bd92fbd780d22406f4bc3681be005f6f04a (diff) |
initial reshuffle
Diffstat (limited to 'core/src/main/java/org/bouncycastle/crypto/agreement/jpake/JPAKERound2Payload.java')
-rw-r--r-- | core/src/main/java/org/bouncycastle/crypto/agreement/jpake/JPAKERound2Payload.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/agreement/jpake/JPAKERound2Payload.java b/core/src/main/java/org/bouncycastle/crypto/agreement/jpake/JPAKERound2Payload.java new file mode 100644 index 00000000..8800cf5f --- /dev/null +++ b/core/src/main/java/org/bouncycastle/crypto/agreement/jpake/JPAKERound2Payload.java @@ -0,0 +1,71 @@ +package org.bouncycastle.crypto.agreement.jpake; + +import java.math.BigInteger; + +import org.bouncycastle.util.Arrays; + +/** + * The payload sent/received during the second round of a J-PAKE exchange. + * <p/> + * <p/> + * Each {@link JPAKEParticipant} creates and sends an instance + * of this payload to the other {@link JPAKEParticipant}. + * The payload to send should be created via + * {@link JPAKEParticipant#createRound2PayloadToSend()} + * <p/> + * <p/> + * Each {@link JPAKEParticipant} must also validate the payload + * received from the other {@link JPAKEParticipant}. + * The received payload should be validated via + * {@link JPAKEParticipant#validateRound2PayloadReceived(JPAKERound2Payload)} + * <p/> + */ +public class JPAKERound2Payload +{ + /** + * The id of the {@link JPAKEParticipant} who created/sent this payload. + */ + private final String participantId; + + /** + * The value of A, as computed during round 2. + */ + private final BigInteger a; + + /** + * The zero knowledge proof for x2 * s. + * <p/> + * This is a two element array, containing {g^v, r} for x2 * s. + */ + private final BigInteger[] knowledgeProofForX2s; + + public JPAKERound2Payload( + String participantId, + BigInteger a, + BigInteger[] knowledgeProofForX2s) + { + JPAKEUtil.validateNotNull(participantId, "participantId"); + JPAKEUtil.validateNotNull(a, "a"); + JPAKEUtil.validateNotNull(knowledgeProofForX2s, "knowledgeProofForX2s"); + + this.participantId = participantId; + this.a = a; + this.knowledgeProofForX2s = Arrays.copyOf(knowledgeProofForX2s, knowledgeProofForX2s.length); + } + + public String getParticipantId() + { + return participantId; + } + + public BigInteger getA() + { + return a; + } + + public BigInteger[] getKnowledgeProofForX2s() + { + return Arrays.copyOf(knowledgeProofForX2s, knowledgeProofForX2s.length); + } + +} |