Example #1
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);
 }
Example #2
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();

            Username = username;
            Credentials = credentials;
            SecretValue = parameters.RandomNumber(parameters.KeyLength);
            Validator = new SRPValidator(this);
        }
Example #3
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));
        }
Example #4
0
 protected SRPBaseContracts(string username, BigInteger credentials, SRPParameters parameters)
     : base(username, credentials, parameters)
 {
 }