1

I've been read a lot about common encryption methods used in a django app.

However, my requirements are very different. I am looking for a way to encrypt my web app data so only the owner of the data is able to access them. That means, even us won't be able to access them.

This means each different document owner will need to have a different decryption key, and obviously we can't store this key on server, otherwise we can also open the documents. Does that mean every time when a user needs to access their document, they will need to input the decryption key? I don't like this, because this makes the web app almost unusable. Are there better alternatives?

  • You might snoop around how Mega handled this issue: end to end encryption. Although you need to be careful because one slip could be fatal. Also see this answer – HamZa Jan 21 '16 at 9:13
  • You might need to look further than django. Django is a backend framework which runs on your server. If you want to go the (arguably) easiest route of storing the keys on the clients machine you'll need to produce a client app that creates a key when the user registers their account and stores it securely on the users machine. – puzzlepalace Jan 21 '16 at 9:17
  • @puzzlepalace That also means the client can't change device, make sure that's what you want. – Neta Jan 22 '16 at 17:55
2

The only way to do this is to deliver the data encrypted to the users browser and have browser code decrypt it.

To achieve that, you must also provide a mechanism for the user to enter some form of key that only they know.

You can simply present that to them as a passcode however and set suitable minimum length/complexity requirements.

It is possible though to cache the security information locally so that the user does not need to keep entering it. Obviously though, the longer you cache it, the more exposed it becomes. But then again, unusable security is every bit as bad as no security.

You could combine the use of your authentication login with local code to create a user owned key by passing the hashed password to the backend for authentication but also running through an algorithm to provide local encryption. This would be reasonably safe since the back end will never know the actual password. Typical passwords do not however contain enough entropy for encryption so you should at least salt the password and probably run through multiple encryption rounds.

I'm afraid I have no idea whether any of this is feasible in Django as I don't use it. Though a quick Google search suggested some hopeful lines of enquiry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.