Ejemplo n.º 1
0
 public SRPClient(string userName, BigInteger credentials, SRPParameters parameters)
     : base(userName, credentials, parameters)
 {
     Contract.Requires(!string.IsNullOrEmpty(userName));
     Contract.Requires(credentials != null);
     Contract.Requires(parameters != null);
 }
Ejemplo n.º 2
0
 public SRPServer(string userName, BigInteger credentials, SRPParameters parameters)
     : base(userName, credentials, parameters)
 {
     Contract.Requires(!string.IsNullOrEmpty(userName));
     Contract.Requires(credentials != null);
     Contract.Requires(parameters != null);
 }
Ejemplo n.º 3
0
        protected SRPBase(string userName, BigInteger credentials, SRPParameters parameters)
        {
            Contract.Requires(!string.IsNullOrEmpty(userName));
            Contract.Requires(credentials != null);
            Contract.Requires(parameters != null);

            Parameters = parameters;

            if (!parameters.CaseSensitive)
                userName = userName.ToUpper(CultureInfo.InvariantCulture);

            UserName = userName;
            Credentials = credentials;
            SecretValue = parameters.RandomNumber(parameters.KeyLength);
            Validator = new SRPValidator(this);
        }
Ejemplo n.º 4
0
        private void TestSRP(SRPParameters srpParams)
        {
            var password = Password.GenerateCredentialsHash(srpParams.Hash, "TEST", "TESTPW");
            var server = new SRPServer("TEST", password, srpParams);
            var client = new SRPClient("TEST", password, srpParams);

            // Client sends A to the server.
            server.PublicEphemeralValueA = client.PublicEphemeralValueA;

            // Server sends s and B to the client.
            client.Salt = server.Salt;
            client.PublicEphemeralValueB = server.PublicEphemeralValueB;

            Assert.IsTrue(client.SessionKey == server.SessionKey);
            Assert.IsTrue(server.Validator.IsClientProofValid(client.Validator.ClientSessionKeyProof));
            Assert.IsTrue(client.Validator.IsServerProofValid(server.Validator.ServerSessionKeyProof));
        }
Ejemplo n.º 5
0
        protected SRPBase(string userName, BigInteger credentials, SRPParameters parameters)
        {
            Contract.Requires(!string.IsNullOrEmpty(userName));
            Contract.Requires(credentials != null);
            Contract.Requires(parameters != null);

            Parameters = parameters;

            if (!parameters.CaseSensitive)
            {
                userName = userName.ToUpper(CultureInfo.InvariantCulture);
            }

            UserName    = userName;
            Credentials = credentials;
            SecretValue = parameters.RandomNumber(parameters.KeyLength);
            Validator   = new SRPValidator(this);
        }
Ejemplo n.º 6
0
 protected SRPBaseContracts(string username, BigInteger credentials, SRPParameters parameters)
     : base(username, credentials, parameters)
 {
 }
Ejemplo n.º 7
0
 protected SRPBaseContracts(string username, BigInteger credentials, SRPParameters parameters)
     : base(username, credentials, parameters)
 {
 }