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
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }