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