How to Store Data That the Computer Can Read But Not the User
In the TV series The Office, Dwight says he uses a diary to keep secrets from his computer. I’m wondering if the opposite is possible: can my computer create a file that it can read but I can’t?
I would guess the starting point would be encryption, rather than permission. But if a file is encrypted, in order to decrypt it again, you need the key stored somewhere, right? If it’s stored in plaintext, obviously the user can access it.
So my question (a weird one, I know) is: how might you do this if you wanted to write software that can access data and prevent the user from doing so?
Answer
There are two ways this can be “more-or-less” achieved (as the other answers pointed out, there is no 100% safe way, as there is no 100% security in general):
- Software obfuscation: it relies on the fact that the execution flow of a program is voluntary and artificially made so cumbersome that it becomes very complex to grasp its logic and understand what is concretely done among (hundreds of) thousands of no-op and misleading operations.
You can find such systems used by DRM enforcement software: the program itself will be able to read the DRM-protected files, but you will not, neither will do any non-DRM compliant software. This is done with the intent to allow you to open a file in a restricted manner (for instance only during a limited period) with no ability to copy it or do any unauthorized actions (printing it for instance).
- Specialized hardware storage: some chips allow to store some information with no possibility to read it back, the chip itself will have internally a full access to this information and will therefore be able to provide some services around this information.
This is typically used to store private keys in HSM-like devices: a cryptographic key is stored in a chip, and programs running on the computer can ask the chip for instance to use the key to encrypt some data, but there is no way to read the key itself from the chip. This is used to ensure that even if some malicious person would be able to access the whole computer’s content, he will not have access to the protected keys.