Jump to content
  • Advertisement
Sign in to follow this  
Sollum

Using RSA encryption to prevent easy texture modding?

This topic is 616 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,

 

Earlier this evening, whilst working on my project, I began wondering, is it possible to encrypt textures, so that no one can mod them or put something inappropriate, that may cause problems.

 

Theoretical plan:

 

Tool:

1) Convert textures to byte arrays

2) Encrypt with RSA Private key

3) Store *.bin files

 

In game:

1) Open *.bin files

2) Decrypt with RSA Public key

3) Load byte arrays into memory

 

Idea is that only me, as a developer, can place textures into the game.

 

Of course, i know that its still possible to place custom stuff into the game, but i want it to be a bit more complicated than "replace a png file".

 

Or is it actually a common tactic?

Or maybe RSA is not meant for that...

Share this post


Link to post
Share on other sites
Advertisement

in short no, anything client side can and will be tampered with if someone really wants to.  even if they don't want to bypass your encryption, they can just tamper with the images after they have been loaded into memory.

Share this post


Link to post
Share on other sites

Or is it actually a common tactic?
 

 

The common tactic involves placing most of the resources in as few files possible, which end up being big. Maybe with some compression that is very fast to decompress (ie, l4z family). Why? Load times. Compression is to reduce the time spent on disk reading, bunching up files into a single directly indexed file reduces OS round trips to request open file handles, and you can mmap it for even easier access, letting the OS page in/out as needed.

 

No one encrypts their assets as far as I am aware.

Share this post


Link to post
Share on other sites
Why are you scared of modding?

For indie studios modding is something to be embraced and encouraged not feared and protected against.

Your game won't be some precious flower that every AAA studio will want to rip off and that every gamer will want to adjust the textures of and lie to claim they made it.

The opposite is true and if you make it open and documented how to mod your game you'll get a cult following and your own modding community which will increase the shelf life of your game in ways you can't imagine.

Stop, and rethink your strategy.

Good luck!

Share this post


Link to post
Share on other sites
Perhaps I'm wrong, but I thought public keys were for encryption and private for decryption? And public keys were somewhat trivial to derive from private keys? It seems like this combination of factors, if true, would defeat any security since you would need to give the clients the private key. Edited by Nypyren

Share this post


Link to post
Share on other sites

Perhaps I'm wrong, but I thought public keys were for encryption and private for decryption? And public keys were somewhat trivial to derive from private keys? It seems like this combination of factors, if true, would defeat any security since you would need to give the clients the private key.

Private is for signing and public for verifying.

RSA is used in certificates and general PK cryptography and is too expensive to use for general encryption of a stream of data.

Generally the correct method is to use rsa to sign and encrypt a 2k block of random data or similar and then if the signature passes validation use that 2k block once decrypted as the key for a faster stream cypher such as AES or twofish.

Using RSA alone to encrypt and decrypt large assets would be lunacy as you'd have to wait for ages for the game to read any file...

Share this post


Link to post
Share on other sites

Hello,

 

Earlier this evening, whilst working on my project, I began wondering, is it possible to encrypt textures, so that no one can mod them or put something inappropriate, that may cause problems.

 

Theoretical plan:

 

Tool:

1) Convert textures to byte arrays

2) Encrypt with RSA Private key

3) Store *.bin files

 

In game:

1) Open *.bin files

2) Decrypt with RSA Public key

3) Load byte arrays into memory

 

Idea is that only me, as a developer, can place textures into the game.

 

Of course, i know that its still possible to place custom stuff into the game, but i want it to be a bit more complicated than "replace a png file".

 

Or is it actually a common tactic?

Or maybe RSA is not meant for that...

 

You can always try an MD5 verification every time the image is loaded into memory.

But like everyone had said ahead of time, there is typically no point in preventing someone from modifying a texture. Because if they really wanted to, they could do it.

If you are worried about someone trying to do something like an Xray texture, you'll be happy to hear that under most scenarios that a transparent texture would never grant someone the ability to see through it unless it was Alpha texted in the shader. That is to say that if an object was never intended to be seen through, in most rendering engines, it will not produce anything behind it.

Share this post


Link to post
Share on other sites

You could use a crc check. Even when the images are loaded in memory, you could check it every x seconds.

 

 

 

You can always try an MD5 verification every time the image is loaded into memory.

But like everyone had said ahead of time, there is typically no point in preventing someone from modifying a texture. Because if they really wanted to, they could do it.

If you are worried about someone trying to do something like an Xray texture, you'll be happy to hear that under most scenarios that a transparent texture would never grant someone the ability to see through it unless it was Alpha texted in the shader. That is to say that if an object was never intended to be seen through, in most rendering engines, it will not produce anything behind it.

 

Where exactly do you plan on storing a CRC/MD5/etc hash that a modder can't also simply overwrite?

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!