Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #6
0
 protected SRPBaseContracts(string username, BigInteger credentials, SRPParameters parameters)
     : base(username, credentials, parameters)
 {
 }
Beispiel #7
0
 protected SRPBaseContracts(string username, BigInteger credentials, SRPParameters parameters)
     : base(username, credentials, parameters)
 {
 }