public void TestValidateGx4() { JPakeUtilities.ValidateGx4(Ten); try { JPakeUtilities.ValidateGx4(BigInteger.One); Fail("exception not thrown for g^x4 equal to 1"); } catch (CryptoException) { // expected } }
public virtual void ValidateRound1PayloadReceived(JPakeRound1Payload round1PayloadReceived) { if (state >= STATE_ROUND_1_VALIDATED) { throw new InvalidOperationException("Validation already attempted for round 1 payload for " + participantId); } partnerParticipantId = round1PayloadReceived.ParticipantId; gx3 = round1PayloadReceived.Gx1; gx4 = round1PayloadReceived.Gx2; BigInteger[] knowledgeProofForX = round1PayloadReceived.KnowledgeProofForX1; BigInteger[] knowledgeProofForX2 = round1PayloadReceived.KnowledgeProofForX2; JPakeUtilities.ValidateParticipantIdsDiffer(participantId, round1PayloadReceived.ParticipantId); JPakeUtilities.ValidateGx4(gx4); JPakeUtilities.ValidateZeroKnowledgeProof(p, q, g, gx3, knowledgeProofForX, round1PayloadReceived.ParticipantId, digest); JPakeUtilities.ValidateZeroKnowledgeProof(p, q, g, gx4, knowledgeProofForX2, round1PayloadReceived.ParticipantId, digest); state = STATE_ROUND_1_VALIDATED; }