Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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;
 }