I'm designing a web application that is going to handle very sensitive data, storing it on behalf of its users. A kind of online safe, if you will.
A user's secure data should only be visible to her, not even to the server software or owner. This opens the way to robust security practices, such as using an end-user password to directly encrypt/decrypt her data, or better, to encrypt a symmetric key used to encrypt her data. The latter would allow changing one's password without re-encrypting all the records on the DB.
Can I ensure an attacker cannot gain access to the protected data, even if they were to obtain root access to my server?
I came up with the notion that I need to encrypt/decrypt the user data on the client side. Modern browsers and hardware make it possible for the user's password and encryption key to never leave her browser. All other techniques I can think of have fatal flaws, whereby an attacker could read the memory of my running server software and find the encryption key.
But then, how can I avoid the attacker planting a web bug into my website, or just changing my client-side script, to send the users' encryption keys their way?
Is there a technology, supported by one or more browsers, where I can require all my website's client-side scripts to be signed with some certificate of mine? For the sake of this question, assume my users trust me to write good software, so they would trust my certificate.
Is there a browser extension that does such checks, that I could recommend my users to install?
In case there is not, how is this threat approached in the industry? Is auditing the only solution? For example, checking my website periodically from external IPs, to make sure that the client-side scripts have not changed cryptographic hash.
Should I forgo the notion of doing something like this with open web technologies and solve the issue by using a trusted software distribution system such as Apple / Google app stores? Would this just move the issue to somebody else's server, or does it actually address the underlying problem?
Can you recommend any good practical books / blogs / articles on the subject?