Beispiel #1
0
        private void ProcessBuffer()
        {
            // buffer may contains multiple packet data
            while (ConstructPacket())
            {
                if (IsMsgNewKeys(_packet))
                {
                    // next packet must be decrypted with the new key
                    _cipher     = null;
                    _mac        = null;
                    _macEnabled = false;
                    _head       = null;

                    _pending = true;    // retain trailing packets in the buffer
                    _keyErrorDetectionTimeout = DateTime.MaxValue;

                    SSH2MsgNewKeys newKeysPacket =
                        new SSH2MsgNewKeys(_packet, new SSH2MsgNewKeys.Handler(OnMsgNewKeysDequeued));

                    _inner_handler.OnData(newKeysPacket);
                    break;
                }

                _inner_handler.OnData(_packet);
            }
        }
Beispiel #2
0
        public override DataFragment Isolate()
        {
            // The new instance returned from this method will be queued into the packet queue.
            // Need to pass delegate object to the new instance to process "dequeued" event.
            DataFragment   newData       = base.Isolate();
            SSH2MsgNewKeys newMsgNewKeys = new SSH2MsgNewKeys(newData, _onDequeued);

            _onDequeued = null;
            return(newMsgNewKeys);
        }
Beispiel #3
0
        private void ProcessBuffer()
        {
            // buffer may contains multiple packet data
            while (ConstructPacket()) {
                if (IsMsgNewKeys(_packet)) {
                    // next packet must be decrypted with the new key
                    _cipher = null;
                    _mac = null;
                    _macEnabled = false;
                    _head = null;

                    _pending = true;    // retain trailing packets in the buffer
                    _keyErrorDetectionTimeout = DateTime.MaxValue;

                    SSH2MsgNewKeys newKeysPacket =
                        new SSH2MsgNewKeys(_packet, new SSH2MsgNewKeys.Handler(OnMsgNewKeysDequeued));

                    _inner_handler.OnData(newKeysPacket);
                    break;
                }

                _inner_handler.OnData(_packet);
            }
        }
Beispiel #4
0
 public override DataFragment Isolate()
 {
     // The new instance returned from this method will be queued into the packet queue.
     // Need to pass delegate object to the new instance to process "dequeued" event.
     DataFragment newData = base.Isolate();
     SSH2MsgNewKeys newMsgNewKeys = new SSH2MsgNewKeys(newData, _onDequeued);
     _onDequeued = null;
     return newMsgNewKeys;
 }