I am running encrypted communication with ping tacked on after decryption and deserialization is complete.
incoming data -> split into packets -> decrypt -> deserializer -> actual message or ping
outgoing message or ping -> serializer -> encrypt -> send
I would prefer ping be handled before any decryption happens and make it part of the lowest socket layer instead.
What I wonder is if I introduce any weakness this way. (The actual crypto layer may be TLS or similar.)
I don't see how manipulating the unencrypted ping would enable much, given that I only use it to test the liveness of the connection and get a RTT.
Am I overlooking something?
Just so this is clear - it relates to a custom server-client protocol for a game. The "ping" here is simply a special packet periodically sent from server to client and then back again.
This helps both client and server ensure that communication is open: one can implement the check "if ping isn't seen within x seconds, assume that the connection is broken".