CalculateK() public static method

public static CalculateK ( IDigest digest, BigInteger N, BigInteger g ) : BigInteger
digest IDigest
N Org.BouncyCastle.Math.BigInteger
g Org.BouncyCastle.Math.BigInteger
return Org.BouncyCastle.Math.BigInteger
Example #1
0
        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));
        }
Example #2
0
        public virtual BigInteger GenerateServerCredentials()
        {
            BigInteger bigInteger = Srp6Utilities.CalculateK(this.digest, this.N, this.g);

            this.privB = this.SelectPrivateValue();
            this.pubB  = bigInteger.Multiply(this.v).Mod(this.N).Add(this.g.ModPow(this.privB, this.N)).Mod(this.N);
            return(this.pubB);
        }
Example #3
0
        private BigInteger CalculateS()
        {
            BigInteger val = Srp6Utilities.CalculateK(this.digest, this.N, this.g);
            BigInteger e   = this.u.Multiply(this.x).Add(this.privA);
            BigInteger n   = this.g.ModPow(this.x, this.N).Multiply(val).Mod(this.N);

            return(this.B.Subtract(n).Mod(this.N).ModPow(e, this.N));
        }
Example #4
0
        private BigInteger CalculateS()
        {
            BigInteger val = Srp6Utilities.CalculateK(digest, N, g);
            BigInteger e   = u.Multiply(x).Add(privA);
            BigInteger n   = g.ModPow(x, N).Multiply(val).Mod(N);

            return(B.Subtract(n).Mod(N).ModPow(e, N));
        }
Example #5
0
        /**
         * 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);
        }