How to safely store encryption key in a .NET assembly

前端 未结 3 832
耶瑟儿~
耶瑟儿~ 2020-12-19 02:37

In order to prevent somebody from grabbing my data easily, I cache data from my service as encrypted files (copy protection, basically).

However, in order to do thi

3条回答
  •  情深已故
    2020-12-19 02:55

    You have to decide what is an acceptable level of risk. There is no "safe" way of doing this.

    If the risk of someone using reflector, or just opening up the assembly using the System.Reflection.Assembly class and grabbing the resource that way, is too great, then your next step is probably to download the key from the server when you start up.

    Then someone will have to do something like debug while using your code and grab the key that way. You can expire stuff that is cached and swap out the keys. You can make it so that individuals each have their own keys to protect one user's data from another user.

    You can do a lot of stuff but if your goal is to keep someone from being able to decrypt information that an assembly you are putting on their machine has the ability to decrypt, you should know it's pretty much impossible. All you can really do is elevate the cost of pirating your keys/data; you can't stop it.

提交回复
热议问题