If I understand you correctly, you will aim at the log encrypted by the server. Requests are sent in the normal mode, but you want to register something like access statistics for each user, etc., and you think that this data is confidential, therefore it should be encrypted by the server, and also be decrypted by the server, if necessary.
If so, it is actually not too complicated.
- Generate an encryption key (AES will be a good choice) that will be used by the server.
- You save this key in a file.
- Make sure that the application and only a few select people have access to this location. In the worst case, it will be used in your public files, and anyone can download it from the Internet. So put it in a folder remote from your public resources :)
- Encrypt this file using password-based encryption for example. PBKDF2 in RFC 2898 .
Then you will understand that you have created a problem with the chicken egg - the file again needs a password to access the key of the key stored inside. But here's the trick - you have to enter the key when starting the server manually and that you need an ephemeral component. The password for the file must be out-of-band information (for example, placed in physical storage) and nowhere else on the computer itself.
An alternative (but potentially less secure, since the password will be present in some physical form) is to rely on special "password stores" for the OS, such as Windows Isolated Storage .
emboss
source share