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()); } }
protected virtual void HandleSignature(Packet4Signature signature) { Disconnect(Packet255Disconnect.DisconnectReason.UnexpectedPacket); }