Beispiel #1
0
        protected override void HandleSignature(Packet4Signature signature)
        {
            //Find an appropriate signature algorithm to use with this signature.
            SignatureAlgorithm selectedAlgorithm = contact.SignatureAlgorithm;

            //Read the packet contents (This is an important process. At this point, we validate the sender.)
            PacketSigned packet = PacketSigned.FromSignature(
                signature.Signature,
                contact.Identity,
                selectedAlgorithm,
                SIGNED_FACTORY
                );

            //Warning: Sender is now verified and trusted.

            //Handle the packet:
            switch (packet.GetPacketID())
            {
            case 1:
                HandleMessage((Packet1Message)packet);
                break;

            default:
                throw new Exception("Unknown signed packet ID: " + packet.GetPacketID());
            }
        }
Beispiel #2
0
 protected virtual void HandleSignature(Packet4Signature signature)
 {
     Disconnect(Packet255Disconnect.DisconnectReason.UnexpectedPacket);
 }