public override SSUState HandleMessage(SSUHeader header, BufRefLen reader)
        {
            if (header.MessageType == SSUHeader.MessageTypes.SessionCreated)
            {
#if LOG_ALL_TRANSPORT
                Logging.LogTransport("SSU SessionConfirmedState " + Session.DebugId + ": Unexpected message received: " + header.MessageType.ToString());
#endif
                return(this);
            }

            Logging.LogTransport("SSU SessionConfirmedState: Session " + Session.DebugId + " established. " +
                                 header.MessageType.ToString() + " received. Moving to Established state.");
            var next = new EstablishedState(Session);
            Session.ReportConnectionEstablished();

            return(next.HandleMessage(header, reader));
        }
        private SSUState VerifyRemoteSignature()
        {
            var baaddr = new BufLen(AAddr);
            var bbport = BufUtils.Flip16BL((ushort)Session.MyRouterContext.UDPPort);

#if LOG_ALL_TRANSPORT
            DebugUtils.Log(string.Format("SSU SessionCreatedState {0}: X for signature {1}.",
                                         Session.DebugId, Request.X));
            DebugUtils.Log(string.Format("SSU SessionCreatedState {0}: Y for signature {1}.",
                                         Session.DebugId, Y.Key));
            DebugUtils.Log(string.Format("SSU SessionCreatedState {0}: Alice address for signature {1}. Port {2}.",
                                         Session.DebugId, baaddr, (BufLen)APort));
            DebugUtils.Log(string.Format("SSU SessionCreatedState {0}: Bob address for signature {1}. Port {2}.",
                                         Session.DebugId, Request.Address, bbport));
            DebugUtils.Log(string.Format("SSU SessionCreatedState {0}: Relay tag {1}. Signon time {2}.",
                                         Session.DebugId, (BufLen)RelayTag, (BufLen)ASignonTime));
#endif

            var signdata = new BufLen[] {
                Request.X, Y.Key,
                baaddr, (BufLen)APort,
                Request.Address, bbport,
                (BufLen)RelayTag, (BufLen)ASignonTime
            };
            var ok = I2PSignature.DoVerify(Session.RemoteRouter.SigningPublicKey, ASign, signdata);
#if LOG_ALL_TRANSPORT
            DebugUtils.Log("SSU SessionCreatedState " + Session.DebugId + ": " +
                           Session.RemoteRouter.Certificate.SignatureType.ToString() +
                           " signature check: " + ok.ToString());
#endif
            if (!ok)
            {
                throw new SignatureCheckFailureException("SSU SessionCreatedState recv sig check failure");
            }

            DebugUtils.Log("SSU SessionCreatedState: Session " + Session.DebugId + " established. Moving to Established state.");
            var next = new EstablishedState(Session);

            Session.ReportConnectionEstablished();

            if (NetDb.Inst != null)
            {
                NetDb.Inst.Statistics.SuccessfulConnect(Session.RemoteRouter.IdentHash);
            }
            return(next);
        }