I have a web application where (among other things) customers can upload files and administrators can then download those files. The uploaded files are stored on
ServerA and the web application used to upload/download those files runs on
I would like to make it so that while the files are stored on
ServerA they are encrypted and that only the web application can encrypt/decrypt, but my concern is that there might not be an effective way to store an encryption key, which would make the file encryption mostly for show.
I came across this question/answer which suggested some good ways to securely store a key, but I think that the most secure ones do not apply since I need different people to be able to decrypt the file.
For example, I cannot create a key based on user credentials, because customers must be able to encrypt all admin users must be able to decrypt (right?).
From what I can tell, my best option is to store the encrypted files on one server and store the encryption key in the code on my web server, but this does not seem particularly secure. It seems likely that if a malicious user gains access to one server they probably gain access to both.
My question - is it even worth implementing "encrypted files on ServerA" and "encryption key on ServerB", or would I just be kidding myself to think this is more secure? Is there an effective way to encrypt files based on the conditions that I laid out above?