Is there any best practice on how to handle "the last mile" in a cloud stored, client side encrypted scenario for a web application? (Sensitive data has to be encrypted before being sent and stored on the server)
Where are the keys stored and what's the best way to get them as safely as possible into the browser/client application?
I understand that this is an imperfect scenario to begin with, but if these are the constraints, what's the best way to handle it?
Trying to clarify more:
We are running a web application that allows doctors to schedule patient visits. We are now asked to provide the possibility to also store sensitive patient data.
The only way we want to even consider this is with client side encryption, i.e. we never get to see or can access any of that sensitive data.
At the same time it has to be viewable / editable in the web-app on the users computer. User authentication, TLS/SSL etc. is already used and properly implemented.
To decrypt existing data or encrypt new data the user will have to provide a keyfile (let's assume regular asymmetric private key for now although we are not entirely sure about that yet - but that's a different discussion).
The question is now what's the best approach for safely storing this keyfile on the users side and how to enable the webapp during use to decrypt/encrypt the data while minimizing the risk of accidentally leaking a key or someone actively stealing it.
I understand there is no way this is going to be a "secure" scenario given the constraints but we are looking for the "least insecure" way to run CSE in a web-app context.