I'm not experienced with encryption at all, so please bear with me.
My use case: I'm working on a membership management web application to be used by a small organisation. When someone becomes a member, his ID gets read and the photo on this ID gets stored on our server. Only a few people with the right permissions are allowed to see the photo via the web application.
Even though it's legal to extract and store these photo's (at least in my country), it's still sensitive data, so I would like to make sure these are stored securely.
My idea is as following: when the user is registered, the image is send to the back-end (as base64 or another readable format, obviously HTTPS is used). The back-end will encrypt this image and generate a guid to be used as the file name. Both the guid and the encryption key are stored in the database as 2 fields in the
users table. The encrypted file gets stored in a folder which is not accessible for the public.
When someone requests a photo, the back-end will check if the user is authorized and if he is, it will look for the file with the right guid, decrypt the photo and send it to the front-end as base64.
My first questions are: is this approach correct? Is the usage of a guid as a filename even adding extra security? My reasoning is: if someone gets access to the folder, he will not be able to see which file belongs to which member. Is storing the encryption key in the database a decent approach?
The thing I'm a bit struggling at, is the encryption itself since I do not have any experience with this. My plan is to use AES and I'm using this article as a reference: https://www.codeproject.com/Articles/769741/Csharp-AES-bits-Encryption-Library-with-Salt
The approach looks simple enough, but I have no idea how to handle the password/key. I was thinking of generating (although I don't know how exactly) a unique password per user on which the key will be generated. Only the key will be stored in the database as that's all I need. In all approaches I've seen however, a single password is used (so the same for all users in my case) and a unique key gets generated by using salts.
I'm not sure why I would need a salt anyway. If I generate a unique password per user, which is long enough and a series of random characters, rainbow tables can't be used. But is that the right approach? And if so, what would be a secure way of generating this password? Or is my reasoning completely wrong and should I do something else?