Encryption

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
P1SQ4M
Posts: 66
Joined: Sat Sep 19, 2009 1:47 am

Encryption

Post by P1SQ4M »

Is there a good free way to encrypt your files, or does irrlicht support any type of encryption?
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Encryption is extremely easy to program yourself.
Here's an example of XOR encryption. It's basic, but is what many of the more powerful encryption methods build upon: http://www.cprogramming.com/tutorial/xor.html
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

XOR encryption != secure.

Here's a good library: http://www.cryptopp.com/
"Whoops..."
P1SQ4M
Posts: 66
Joined: Sat Sep 19, 2009 1:47 am

Post by P1SQ4M »

XOR encryption looks great, but possibly a little basic (which may be what I need for real time decryption, I'm not sure everyone has 3 gigs of ram yet...).
I think a library would be the way to go! That one looks great, but the only "documentation" is for a previous version and "the syntax has changed allot". Still I think a library would be great, and now I've got some names to go on and some code to try out.

Thanks!
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

No encryption is secure at the client end, you need to store the private keys in the application where they can be read by anyone who bothers to dig them out.
Because of this problem, even the best encryption is really just obfuscation; a matter of hiding the keys. Mixing up the data in your own special way will probably be more secure than off the shelf encryption.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

P1SQ4M wrote:XOR encryption looks great, but possibly a little basic (which may be what I need for real time decryption, I'm not sure everyone has 3 gigs of ram yet...).
I use AES encryption for my network packets in realtime.
P1SQ4M wrote: That one looks great, but the only "documentation" is for a previous version and "the syntax has changed allot".
There's a nice example application in the SDK and the wiki has lots of information too.
"Whoops..."
Alpha Omega
Posts: 288
Joined: Wed Oct 29, 2008 12:07 pm

Post by Alpha Omega »

I know i am a noob but has anyone tried doing the offensive approach. That is design the program so that when someone try's to find the information the client then sees this and purposely gives the wrong information? But would it fool the hacker? That is the real question...
P1SQ4M
Posts: 66
Joined: Sat Sep 19, 2009 1:47 am

Post by P1SQ4M »

Thanks, I think I'll work with that. :)

You can do that, and it might buy you time, but if in the end he can't do whatever he wants in the game, he knows he hasn't got it and will go look again.
jpoag
Posts: 25
Joined: Mon Aug 10, 2009 1:00 am

Post by jpoag »

We use simple XOR encryption, coupled with a PAK file to speed up file loading. Basically, PAK all of your files into a single file and use filemapping to seek through it. Use XOR to encrypt the PAK file. You might have to write some file loaders to make it work with Irrlicht. The hacker then has to guess the file format (not hard, I do it all the time) and decrypt it at the same time. It's a little harder when the entire PAK file is encrypted.

The XOR encryption doesn't have to be a single byte, you can use a really long character string and cycle through it to get your XOR keys using the modulo operator.

P.S. I have a lot of experience mapping out file formats. Not specifically for games, although I have done a couple of those too. It's harder to determine a file format that is already encrypted (although a single XOR byte key isn't hard). If the file table isn't encrypted, then it's harder too...
-James
P1SQ4M
Posts: 66
Joined: Sat Sep 19, 2009 1:47 am

Post by P1SQ4M »

Great advice, could the person run the brute force untill it comes up as a recognizeable file type, or does it just take more time? (good too :) )
If the file table isn't encrypted, then it's harder too...
do you mean is?

Thanks :)
jpoag
Posts: 25
Joined: Mon Aug 10, 2009 1:00 am

Post by jpoag »

P1SQ4M wrote:Great advice, could the person run the brute force untill it comes up as a recognizeable file type, or does it just take more time? (good too :) )
If the file table isn't encrypted, then it's harder too...
do you mean is?

Thanks :)
Yeah, 'is'. Sorry.

Yeah, when I run brute force, it's with a single BYTE XOR key looking for a JPEG or GIF89a header (or PNG, wav, ogg, etc...). With a rotating XOR key based around the modulo operator, it's a LOT harder unless I know the header format.

Sample source:
http://code.assembla.com/sexy/subversio ... erface.cpp

The header for that PAK format has 8 known characters, the Magic WORD and the Format version (stored as 2 DWORDs). If the rotating key were shorter than 8 characters, then I would immediately know the password. If it were longer, then I code a significant portion of the file looking for known headers.

But this isn't a discussion about strength. Really, what it comes down to is how hard to do want to make the encryption and how much time you want to spend on it. My philosophy is that if someone really wants to get at your data, they will. Just set the bar high enough so that it really takes someone a great deal of time and/or effort.

Time is like money. If there is too much time/effort needed to crack the format then a lot of people will move on to something more fruitful.

The time argument also applies to the creation of the encryption. Here you will run into the law of diminishing returns. For instance, a PAK file is a great idea, but if you are fixing to ship your product and have no clue about file mapping (see sample source) then it may not be a great return or your time invested (more headaches).
-James
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

I think Windows has CryptoAPI that can do exactly what you need.

Check Both Links:
http://www.codeproject.com/KB/security/ ... toAPI.aspx

http://www.codeguru.com/cpp/misc/misc/cryptoapi/

There you should find everything you need to do what you want.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
Post Reply