Imagine web apps that are supposed to work with no or only a few interactions with the web server, for example:

  • a browser game in which the player's level and progress are to be saved locally.
  • a game, progressive web app or browser extension with the possibility of in-app purchases in which the paid-for, unlocked features are to be saved locally.

In each case, tampering of that critical data on the client side is to be ruled out. E.g., the user should be prevented from "cheating" by accessing and manipulating the local data store, be it the local storage or an IndexedDB, through the developer's console.

I understand that with Web Crypto API the key of let's say, a AES-GCM encryption, can be saved as a special crypto key type in IndexedDB and is hence still usable locally, but can't be viewed due to its opaqueness. However, a naive scheme consisting in the web app saving the crypto key, initialization vector and encrypted player's progress/in-app purchases in IndexedDB could be easily compromised as the user could simply use the key and iv to decrypt and then re-encrypt the data.

Things might improve if the key was stored on the server, but this would defeat the goal of reducing server interaction plus we would need to a scheme preventing the user from requesting that key from the server such as the web app does.

I'd like to pick your brains on this. Do you think what I set out to do is feasible at all, and yes, what would a solution look like?

  • 1
    You are trying to implement a Digital Rights Management (DRM) system. DRMs are ineffective, not to mention sometimes unethical. The best DRMs in the world have all been cracked by people in their free time for fame in piracy circles. You don't need a DRM, just ask people to buy stuff and hope that they will. The Witcher 3 is one of the best-selling PC games recently, and it was released without DRM by its publisher. Most people who like a game aren't going to pirate it. – markasoftware Sep 2 '18 at 17:37
  • I understand what you're saying and you are right that most people will be happy to pay. Nevertheless, many big firms have not given up on DRM. Apple changed their itunes file format to MP3, but to circumvent the DRM of its app store you need to jailbreak your device. Or look at Adobe with its Creative Cloud. I would appreciate if we could discuss the content of my question. – Steve06 Sep 3 '18 at 18:07
  • @Steve06 all the examples you gave are broken. DRM is not possible. You could try to use dedicated hardware chips like game consoles, but all of them where also broken after some time. If you are restricted to software only solutions, it's just not possible at all. – Josef Oct 5 '18 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.