Пример #1
0
        protected override void DHNegotiate()
        {
#if LOG_ALL_TRANSPORT
            DebugUtils.Log("X1X +" + TransportInstance.ToString() + "+");
#endif

            DHHandshakeContext dhcontext = new DHHandshakeContext(this);
            dhcontext.RunContext = NTCPContext;

            SessionRequest.Receive(dhcontext, BlockReceive(288));
#if LOG_ALL_TRANSPORT
            DebugUtils.Log("X2X +" + TransportInstance.ToString() + "+");
#endif

            SendRaw(SessionCreated.Send(dhcontext));

            SessionConfirmA.Receive(dhcontext, BlockReceiveAtLeast(448, 2048));
#if LOG_ALL_TRANSPORT
            DebugUtils.Log("X3X +" + TransportInstance.ToString() + "+");
#endif

            SendRaw(SessionConfirmB.Send(dhcontext));

#if LOG_ALL_TRANSPORT
            DebugUtils.Log("X4X +" + TransportInstance.ToString() + "+");
#endif
            NetDb.Inst.Statistics.SuccessfulConnect(NTCPContext.RemoteRouterIdentity.IdentHash);

            NTCPContext.SessionKey = dhcontext.SessionKey;
            NTCPContext.Encryptor  = dhcontext.Encryptor;
            NTCPContext.Dectryptor = dhcontext.Dectryptor;
        }
Пример #2
0
        protected override void DHNegotiate()
        {
#if LOG_MUCH_TRANSPORT
            Logging.LogTransport("1 +" + TransportInstance.ToString() + "+");
#endif

            DHHandshakeContext dhcontext = new DHHandshakeContext(this);
            dhcontext.RemoteRI   = NTCPContext.RemoteRouterIdentity;
            dhcontext.RunContext = NTCPContext;

            SendRaw(SessionRequest.Send(dhcontext));
            SessionCreated.Receive(dhcontext, BlockReceive(304));
#if LOG_MUCH_TRANSPORT
            Logging.LogTransport("2 +" + TransportInstance.ToString() + "+");
#endif

            SendRaw(SessionConfirmA.Send(dhcontext));
            SessionConfirmB.Receive(dhcontext, NTCPContext.RemoteRouterIdentity);

#if LOG_MUCH_TRANSPORT
            Logging.LogTransport("3 +" + TransportInstance.ToString() + "+");
#endif

            NTCPContext.SessionKey = dhcontext.SessionKey;
            NTCPContext.Encryptor  = dhcontext.Encryptor;
            NTCPContext.Dectryptor = dhcontext.Dectryptor;
        }