Let's say we have a requirement that every file users upload to our ASP.NET Core MVC application must be stored in encrypted form in a shared folder, and these files must remain until the user deletes them (so it can be a long time). The shared folder part is not hard, but what's the "proper" way to encrypt uploaded files? What we get when the user uploaded the file is a string with the original file name and a stream with the contents of the file, so that's the starting point but I don't know how to proceed from there.
There are plenty of Google results but all of those use primitives directly on the stream, and I guess there are some glaring security holes when doing that, so there must be a proper way to do so.