Maybe this topic is not in the good section but I'm remembering a thread where people were talking about doing encryption for images and maybe other files such as sounds/music. Anyway, how do you protect your content such as images and sounds? I intend to use png images and ogg files for sound (still don't know for music). I'd like to use them in an unsecured fashion at dev time and encrypt them at distribution time only and the game knows that it has to decrypt them for production use. I know that many companies define their own image format but I'd like to avoid this as much as possible. Same idea for sound...

I would write my own classloader that pipes everthing through a javax.crypto.CipherInputStream, then access the standard type files as normal via getResource() and getResourceAsStream().

Of course, keep in mind that encrypting data gives you FAR from as much security as you might think. There's no way to make it secure, so the only question is how many trivial hoops you make people jump through before getting the content.(and you need to jump through those hoops as well when implementing it)

Not sure if this is a good idea or not. But why dont you corrup the files? I.e. Add a little key at the top/bottom (or both) of the png file (in bytes) and just read if that key is valid or not. If so, then read whats in between. I can see alot of problems with that to. I.e. you dont use the normal ImageIO stuff, you can probably find a back way through....

The most secure thing would be to currept the files in some way. That will prevent people form just opening the files in their favorite viewer. It do not mather if you use the most advanced encryption in the world, or basic xoring. They got your code and can decrypt it no mather what.

I've already thought about that but it's not really secure. Thanks for your help.

There is no secure way to do this.You might as well use XOR rather than some complex crypto.. since your program itself will contain the code to decrypt the images it's like locking a door but leaving the key in the lock.

OK thanks for ideas. I ask the question because in the future when my game will go live, I don't want companies to stole images and sound/music contained in the game and reuse it for their own commercial purposes. I don't know if this could happen.

I'd just like to point out that your art and sound, individually... are pretty worthless, from a commercial perspective. In other words no commercial entity is going to dream of taking your graphics and sounds without permission because the risks are big and the rewards trivial. That just leaves hobbyists and modders and so on... and what's the harm in letting them play with your stuff? A few bleeps and boops and a grass texture ain't so much to give away is it?

Even if it were professionally developed graphics and sound... in fact especially if it were professional. It's just something that you're worrying about that isn't really a problem. Like piracy: there is nothing realistic that can be done about stopping it, so you just need to work out how to make money regardless of piracy.

but as princec stated out, you have to be certain that if somebody wants to steal your work, he will succeed...

Quite right, MOST watermarks can easily be removed with something similiar to the "clone brush" on Photoshop. Either way the thief might not want the part of the image that has the watermark and would just crop what he wants out

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org