So my problem, in its general form, is encrypting test questions such that a client-side testing application can access the questions while students cannot. The naive approach, in my opinion, is to use a symmetric key algorithm, with the key hard-coded within the application, to encrypt and decrypt the questions. The problem of course being that any student with some security savvy could recover the key.

Assuming that a server-based approach is not viable (no internet connectivity), is there a way to secure questions in this scenario such that the application can decrypt them, students cannot, and the key is not stored within the application? I suspect I know the answer, but I would like to hear from those more knowledgeable than myself.

  • 1
    You can make it difficult. But if they have control of the client hardware and software, there's nothing you can do to prevent a determined attacker.
    – gowenfawr
    Mar 3, 2015 at 18:34
  • 1
    It would take a decent amount of savy to find the key. You could generate a key based off of a user's machine information. Which would make it unique to each install. But that just adds obscurity to the process and can still be recovered if students were dedicated enough. Without a server based approach, I'm not sure how you'd do this.
    – RoraΖ
    Mar 3, 2015 at 18:34
  • That was my take on it as well. That's a good point about generating the key dynamically. At least then students couldn't share the key between computers. But they could still easily share the process.
    – Ryan O.
    Mar 3, 2015 at 19:02
  • It would be possible if students did not have rooted/jail broken phones. In this case the OS would protect the app's database from the user. Mar 3, 2015 at 21:16

1 Answer 1


No, you cannot secure data completely if the user has total control of the system and its hardware (and possibly a lot of money; attacking hardware can get quite expensive).

If this is just to prevent cheating, hardcoding the encryption key in an obfuscated manner (so that strings doesn't find it) should be enough though (any student breaking that probably deserves a good grade anyways).

If you are handing out the hardware along with the software (how else would you pass it to the students without internet?) you could go with the approach suggested by raz: encrypt the data with a key based on the computers hardware (eg by adding a PUF to the hardware; but again, access to the hardware means that this can be broken).

You could also look into trusted computing, which tries to achieve what you want (but still, complete access to the hardware means that it can be bypassed with enough money and time).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .