/// <summary> /// Validates the payload received from the other participant during round 2. /// Note that this DOES NOT detect a non-common password. /// The only indication of a non-common password is through derivation /// of different keys (which can be detected explicitly by executing round 3 and round 4) /// /// Must be called prior to CalculateKeyingMaterial(). /// /// After execution, the State state will be STATE_ROUND_2_VALIDATED. /// /// Throws CryptoException if validation fails. Throws /// InvalidOperationException if called prior to ValidateRound1PayloadReceived(JPakeRound1Payload), or multiple times /// </summary> public virtual void ValidateRound2PayloadReceived(JPakeRound2Payload round2PayloadReceived) { if (this.state >= STATE_ROUND_2_VALIDATED) throw new InvalidOperationException("Validation already attempted for round 2 payload for " + this.participantId); if (this.state < STATE_ROUND_1_VALIDATED) throw new InvalidOperationException("Round 1 payload must be validated prior to validation round 2 payload for " + this.participantId); BigInteger gB = JPakeUtilities.CalculateGA(p, gx3, gx1, gx2); this.b = round2PayloadReceived.A; BigInteger[] knowledgeProofForX4s = round2PayloadReceived.KnowledgeProofForX2s; JPakeUtilities.ValidateParticipantIdsDiffer(participantId, round2PayloadReceived.ParticipantId); JPakeUtilities.ValidateParticipantIdsEqual(this.partnerParticipantId, round2PayloadReceived.ParticipantId); JPakeUtilities.ValidateGa(gB); JPakeUtilities.ValidateZeroKnowledgeProof(p, q, gB, b, knowledgeProofForX4s, round2PayloadReceived.ParticipantId, digest); this.state = STATE_ROUND_2_VALIDATED; }
public virtual void ValidateRound2PayloadReceived(JPakeRound2Payload round2PayloadReceived) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (state >= STATE_ROUND_2_VALIDATED) { throw new InvalidOperationException("Validation already attempted for round 2 payload for " + participantId); } if (state < STATE_ROUND_1_VALIDATED) { throw new InvalidOperationException("Round 1 payload must be validated prior to validation round 2 payload for " + participantId); } BigInteger ga = JPakeUtilities.CalculateGA(p, gx3, gx1, gx2); b = round2PayloadReceived.A; BigInteger[] knowledgeProofForX2s = round2PayloadReceived.KnowledgeProofForX2s; JPakeUtilities.ValidateParticipantIdsDiffer(participantId, round2PayloadReceived.ParticipantId); JPakeUtilities.ValidateParticipantIdsEqual(partnerParticipantId, round2PayloadReceived.ParticipantId); JPakeUtilities.ValidateGa(ga); JPakeUtilities.ValidateZeroKnowledgeProof(p, q, ga, b, knowledgeProofForX2s, round2PayloadReceived.ParticipantId, digest); state = STATE_ROUND_2_VALIDATED; }
public ExchangeAfterRound2Creation( JPakeParticipant alice, JPakeRound2Payload aliceRound2Payload, JPakeRound2Payload bobRound2Payload) { this.alice = alice; this.aliceRound2Payload = aliceRound2Payload; this.bobRound2Payload = bobRound2Payload; }