<p>Some web applications, like Google Docs, store data generated by the users. Data that can only be read by its owner. Or maybe not?</p>

<p>As far as I know, this data is stored as is in a remote database. So, if anybody with enough privileges in the remote system (a sysadmin, for instance) can lurk my data, my privacy could get compromised.</p>

<p>What could be the best solution to store this data encrypted in a remote database and that only the data's owner could decrypt it? How to make this process transparent to the user? (You can't use the user's password as the key to encrypt his data, because you shouldn't know his password).</p>

[{'answer_id': 39797, 'author': 'Carl Seleborg', 'author_id': 2095, 'author_profile': 'https://Stackoverflow.com/users/2095', 'pm_score': 4, 'selected': True, 'text': '<p>If encryption/decryption is performed on the server, there is no way you can make sure that the cleartext is not dumped somewhere in some log file or the like.</p>\n\n<p>You need to do the encryption/decryption inside the browser using JavaScript/Java/ActiveX or whatever. As a user, you need to trust the client-side of the web service not to send back the info unencrypted to the server.</p>\n\n<p>Carl</p>\n'}, {'answer_id': 39806, 'author': 'Dmitry Shechtman', 'author_id': 3583, 'author_profile': 'https://Stackoverflow.com/users/3583', 'pm_score': -1, 'selected': False, 'text': "<p>No, you can't use passwords, but you could use password hashes. However, Google Docs are all about sharing, so such a method would require storing a copy of the document for each user.</p>\n"}, {'answer_id': 39812, 'author': 'UnkwnTech', 'author_id': 115, 'author_profile': 'https://Stackoverflow.com/users/115', 'pm_score': 2, 'selected': False, 'text': "<p>I think Carl, nailed it on the head, but I wanted to say that with any website, if you are providing it any confidential/personal/privileged information then you have to have a certain level of trust, and it is the responsibility of the service provider to establish this trust.  This is one of those questions that has been asked many times, across the internet since it's inception, and it will only continue to grow until we all have our own SSL certs encoded on our fingerprint, and even then we will have to ask the question 'How do I know that the finger is still attached to the user?'.</p>\n"}, {'answer_id': 39815, 'author': 'cringe', 'author_id': 834, 'author_profile': 'https://Stackoverflow.com/users/834', 'pm_score': 1, 'selected': False, 'text': '<p>Well, I\'d consider a process similar to Amazons AWS. You authenticate with a private password that is not saved remotely. Just a hash is used to validate the user. Then you generate a certificate with one of the main and long-tested algorithms and provide this from a secure page. Then a public/private key algorithm can be used to encrypt things for the users.</p>\n\n<p>But the main problem remains the same: If someone with enough privileges can access the data (say: hacked your server), you\'re lost. Given enough time and power, everything could be breaked. It\'s just a matter of time.</p>\n\n<p>But I think algorithms and applications like GPG/PGP and similar are very well known and can be implemented in a way that secure web applications - and keep the usability at a score that the average user can handle.</p>\n\n<p><strong>edit</strong> I want to catch up with <a href="https://stackoverflow.com/users/2095/carl-seleborg">@Carl</a> and <a href="https://stackoverflow.com/users/115/unkwntech">Unkwntech</a> and add their statement: If you don\'t trust the site itself, don\'t give private data away. That\'s even before someone hacks their servers... ;-)</p>\n'}, {'answer_id': 41322, 'author': 'Carl Seleborg', 'author_id': 2095, 'author_profile': 'https://Stackoverflow.com/users/2095', 'pm_score': 1, 'selected': False, 'text': '<blockquote>\n  <p>Auron asked: How do you generate a key for the client to encrypt/decrypt the data? Where do you store this key?</p>\n</blockquote>\n\n<p>Well, the key is usually derived from some password the user has chosen. You don\'t store it, you trust the user to remember it. What you can store is maybe some salt value associated to that user, to increase security against rainbow-table attacks for instance. </p>\n\n<p>Crypto is hard to get right ;-) I would recommend to look at the source code for <a href="http://www.axantum.com/AxCrypt/" rel="nofollow noreferrer">AxCrypt</a> and for <a href="http://www.axantum.com/Xecrets/Default.aspx" rel="nofollow noreferrer">Xecrets</a>\' off-line client.</p>\n\n<p>Carl</p>\n'}]
['https://Stackoverflow.com/questions/39772', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1679/']