예제 #1
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;
        }
예제 #2
0
        protected override void DHNegotiate()
        {
#if LOG_MUCH_TRANSPORT
            Logging.LogTransport("X1X +" + TransportInstance.ToString() + "+");
#endif

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

            SessionRequest.Receive(dhcontext, BlockReceive(288));
#if LOG_MUCH_TRANSPORT
            Logging.LogTransport("X2X +" + TransportInstance.ToString() + "+");
#endif

            SendRaw(SessionCreated.Send(dhcontext));

            SessionConfirmA.Receive(dhcontext, BlockReceiveAtLeast(448, 2048));
#if LOG_MUCH_TRANSPORT
            Logging.LogTransport("X3X +" + TransportInstance.ToString() + "+");
#endif

            SendRaw(SessionConfirmB.Send(dhcontext));

#if LOG_MUCH_TRANSPORT
            Logging.LogTransport("X4X +" + TransportInstance.ToString() + "+");
#endif
            NetDb.Inst.Statistics.SuccessfulConnect(NTCPContext.RemoteRouterIdentity.IdentHash);

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

            RouterContext.Inst.IsFirewalled = false;
        }