/** * Computes the final session key as a result of the SRP successful mutual authentication * To be called after verifying the server evidence message M2. * @return Key: the mutually authenticated symmetric session key * @throws CryptoException */ public virtual BigInteger CalculateSessionKey() { // Verify pre-requirements (here we enforce a previous calculation of M1 and M2) if (this.S == null || this.M1 == null || this.M2 == null) { throw new CryptoException("Impossible to compute Key: " + "some data are missing from the previous operations (S,M1,M2)"); } this.Key = Srp6Utilities.CalculateKey(digest, N, S); return(Key); }