As pointed out in the comments, you cannot reliably enforce your second point (viewing without downloading). I think what you have in mind is some kind of client-side mitigation. Keep in mind that at best, you are delaying a motivated user. As pointed out in the comments to your question, in order to be displayed the client has to receive a copy of the data sent by the server. Now, there are some pdf viewing libraries that try to obfuscate the source of the data. They are at worse an inconvenience.
Back to the rest of your question, it is impossible to answer without more information. Are keys allowed to be shared? Should they be revokable? Do you want an user to be able to recover their files if they lost their secret key? Do you want to dynamically adjust the set of people allowed to view a certain file? and many more.
Database encryption is a well researched topic. And it is also extremely vast. Please narrow down the problem.