Using RSA encryption to prevent easy texture modding?

Started by
17 comments, last by Shaarigan 7 years, 5 months ago

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...

Advertisement

that may cause problems

Such as?

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

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.

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

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.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

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!

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

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.

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...

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.

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?

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

This topic is closed to new replies.

Advertisement