private BigInteger CalculateS() { BigInteger k = Srp6Utilities.CalculateK(digest, N, g); BigInteger exp = u.Multiply(x).Add(privA); BigInteger tmp = g.ModPow(x, N).Multiply(k).Mod(N); return(B.Subtract(tmp).Mod(N).ModPow(exp, N)); }
/** * Generates the server's credentials that are to be sent to the client. * @return The server's public value to the client */ public virtual BigInteger GenerateServerCredentials() { BigInteger k = Srp6Utilities.CalculateK(digest, N, g); this.privB = SelectPrivateValue(); this.pubB = k.Multiply(v).Mod(N).Add(g.ModPow(privB, N)).Mod(N); return(pubB); }