コード例 #1
0
        public void HandleClientKeyExchange(ClientKeyExchangeMessage message)
        {
            var preMasterSecret = ReadMessage(message.Body);

            var masterSecret = _masterSecretCalculator.Compute(preMasterSecret);

            // TODO return type?
            _masterSecretCalculator.ComputeKeysAndUpdateConfig(masterSecret);
        }
コード例 #2
0
        public void HandleClientKeyExchange(ClientKeyExchangeMessage message)
        {
            var dhMessage       = DHClientKeyExchangeMessage.Read(message.Body);
            var sharedSecret    = DHCalculator.Calculate(dhMessage.Yc, _dhExchangeConfig.X, _dhParameterConfig.P);
            var preMasterSecret = sharedSecret.ToByteArray(Endianness.BigEndian);

            var masterSecret = _masterSecretCalculator.Compute(preMasterSecret);

            _masterSecretCalculator.ComputeKeysAndUpdateConfig(masterSecret);
        }
コード例 #3
0
        public virtual void HandleClientKeyExchange(ClientKeyExchangeMessage message)
        {
            var qc = ReadMessage(message);

            var sharedSecret = CalculatePoint(qc);

            var preMasterSecret = sharedSecret.X.Value.ToByteArray(Endianness.BigEndian);

            var masterSecret = MasterSecretCalculator.Compute(preMasterSecret);

            MasterSecretCalculator.ComputeKeysAndUpdateConfig(masterSecret);
        }
コード例 #4
0
        public void HandleServerKeyExchange(ServerKeyExchangeMessage message)
        {
            var dhMessage = DHServerKeyExchangeMessage.Read(_serviceProvider, message.Data);

            _dhParameterConfig.G = dhMessage.G;
            _dhParameterConfig.P = dhMessage.P;

            // 512 is "approx" 256-bits of security
            _dhExchangeConfig.X = _random.RandomBig(512);

            var sharedSecret    = DHCalculator.Calculate(dhMessage.Ys, _dhExchangeConfig.X, _dhParameterConfig.P);
            var preMasterSecret = sharedSecret.ToByteArray(Endianness.BigEndian);

            var masterSecret = _masterSecretCalculator.Compute(preMasterSecret);

            _masterSecretCalculator.ComputeKeysAndUpdateConfig(masterSecret);
        }