public virtual BigInteger CalculateClientEvidenceMessage() { if (this.pubA == null || this.B == null || this.S == null) { throw new CryptoException("Impossible to compute M1: some data are missing from the previous operations (A,B,S)"); } this.M1 = Srp6Utilities.CalculateM1(this.digest, this.N, this.pubA, this.B, this.S); return(this.M1); }
/** * Computes the client evidence message M1 using the previously received values. * To be called after calculating the secret S. * @return M1: the client side generated evidence message * @throws CryptoException */ public virtual BigInteger CalculateClientEvidenceMessage() { // Verify pre-requirements if (this.pubA == null || this.B == null || this.S == null) { throw new CryptoException("Impossible to compute M1: " + "some data are missing from the previous operations (A,B,S)"); } // compute the client evidence message 'M1' this.M1 = Srp6Utilities.CalculateM1(digest, N, pubA, B, S); return(M1); }
public virtual bool VerifyClientEvidenceMessage(BigInteger clientM1) { if (this.A == null || this.pubB == null || this.S == null) { throw new CryptoException("Impossible to compute and verify M1: some data are missing from the previous operations (A,B,S)"); } BigInteger bigInteger = Srp6Utilities.CalculateM1(this.digest, this.N, this.A, this.pubB, this.S); if (bigInteger.Equals(clientM1)) { this.M1 = clientM1; return(true); } return(false); }
/** * Authenticates the received client evidence message M1 and saves it only if correct. * To be called after calculating the secret S. * @param M1: the client side generated evidence message * @return A boolean indicating if the client message M1 was the expected one. * @throws CryptoException */ public virtual bool VerifyClientEvidenceMessage(BigInteger clientM1) { // Verify pre-requirements if (this.A == null || this.pubB == null || this.S == null) { throw new CryptoException("Impossible to compute and verify M1: " + "some data are missing from the previous operations (A,B,S)"); } // Compute the own client evidence message 'M1' BigInteger computedM1 = Srp6Utilities.CalculateM1(digest, N, A, pubB, S); if (computedM1.Equals(clientM1)) { this.M1 = clientM1; return(true); } return(false); }