Jump to content
  • Advertisement
Sign in to follow this  
Yberion

Packet Encryption

This topic is 2943 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello!

Is was wondering about the pros and cons of crypting the packages between server and clients. Crypting would make harder to users view the protocols, but not impossible, since they can just reverse-engeneer the whole thing. But crypting has and impact on performance.

So, what do you guys think? Is that extra security worth the performance loss?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
"Harder but not impossible" isn't extra security. It's just extra work (for you and for them). Encrypt your protocols if you like, but if you're relying on your protocol remaining obscure in order to prevent cheating, you will not be successful.

Share this post


Link to post
Share on other sites
If you need to secure data against man-in-the middle (if the data has economic value), then use SSL.
Else, don't encrypt, IMO.

Share this post


Link to post
Share on other sites
Hmm.. I see.. I'm not using any crypt right now. But since so many big games around use it, I thought I might look up why they did it.

Thanks

Share this post


Link to post
Share on other sites
There is a noticeable performance hit if you choose to encrypt all your traffic. For this reason, we only encrypt transmissions during phases that might contain confidential information (i.e. login) and switch back to unencrypted transmissions during gameplay.

Share this post


Link to post
Share on other sites
If you use a symmetric cypher, like AES or XTEA, there shouldn't be a noticable impact at the rate of data transfer that you can typically use in a game.

Share this post


Link to post
Share on other sites
I have never seen harm in using a fast symmetric encryption just to help obfuscate the data as long as your server can handle it. Performance with clients are of no concern (its not like you're transferring hundreds of KBs of data every second... I hope), but the server is transferring a lot of data. Just don't forget that your data is not secure, its just obfuscated.

The transfer of information that must remain private, such as account credentials, would need a much more robust form of asymmetric security if privacy is a concern. That kind of encryption will end up costing a lot more in comparison to symmetric.

Of course, for most any internet-based game, you should be designing it under the assumption that the client cannot be trusted at all in any way.

Share this post


Link to post
Share on other sites
Symmetric encryption won't increase the CPU use that much. Some games consoles use length preserving symmetric ciphers. This is effectively obfuscation and some protection against tampering of packets without the pain of giving up some bandwidth for the crypto.

It is great until someone debugs your code and hooks just before the crypto stage. :)

Share this post


Link to post
Share on other sites
Pretty much all symmetric cyphers are length preserving.

If you want just obfuscation, I suggest using a one-time pad implemented by XOR-ing with the output of a Mersenne Twister seeded with the cypher key. This costs something like three cycles total for every 4 bytes. If you use UDP, you'll need some way to select the "pad" though, which adds at least one byte in size.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yberion
So, what do you guys think? Is that extra security worth the performance loss?

First, who are you trying to protect against, and what are you trying to protect?

You already understand that a determined cheater is always going to cheat, and nothing you can do will stop them.

Crypto is mainly useful in protecting the content from being observed. What are you afraid they will observe in your packets?

Confidential information is a great candidate. Use an existing security library to convert your username and password into a session ID.

But once you have a session, what are you afraid that they will observe? A well-written protocol is in the form of requests and replies. An attacker should be able to issue thousands of invalid requests, and you should be able to deny them trivially. Even if they know the details of your protocol you should still be able to deny invalid requests.





Next, there is no significant "performance loss". The nanoseconds it takes to encode a packet is virtually nothing compared to the milliseconds it takes to travel the wire. Encryption libraries for SSL have very little overhead other than establishing the session.



You said you assume that many big games use encryption and wanted to know why. Lawyers and business insurance like to have checklists. For example they require the use of network firewalls, but rarely do they require them to be properly configured. It shows that they are making an effort, even if the effort is minuscule. Saying that an attacker broke an encrypted connection implies that some security steps were taken.


The development teams don't bother implementing the low-level communication, they simply use the existing libraries. The only difference between a raw connection and an encoded connection is a single function parameter. They can pass 'true' or 'false' to the communication library and the encryption happens automatically.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!