0

I have an application that encodes data when writing it to a database, and unencodes it when reading from the database. The encoding is done with a symmetric algorithm using a fixed secret key.

I'm imagining a situation where an attacker has gained access to the machine running the application, and assume for simplicity that the database is also running locally on that machine.

The question is how well I can protect the secret key, so that if the user downloads the database they can't do anything with it. One idea is to enter the key manually each time I start the application server. In that case, it seems like, to get the key, a hacker would have to dump the core memory of the running server, and then somehow find the key in that memory, which I could further obfuscate with a separate encrypt/decrypt. Assuming the user doesn't have access to the application source code (e.g., a .py file), it means they'd have to dump memory and reverse engineer the source code (e.g., from a .pyc file) to understand how/where the key was encoded in memory.

Is this a good idea? Is there a name for it? Does it get me any farther than other methods that don't require inputting the key at process start time?

1
  • 1
    Your solution of entering the key manually at startup is better than solutions where the key is stored somewhere in permanent storage, but not as good as other solutions involving a HSM or KMS. See security.stackexchange.com/questions/12332/… for some interesting reading on this subject.
    – mti2935
    Commented Oct 2, 2023 at 16:40

0

You must log in to answer this question.

Browse other questions tagged .