Domanda

I have an Android application that transmits some user account information as json over ssl to a central server. 3rd parties can send messages to the users if they have the users' username.

The username can never be queried from our server, infact no user data can be queried. The entire system relies on the fact that the user willingly shared there information with the 3rd parties and the 3rd parties can use that information to deliver messages to the users.

The transmitted data is not encrypted by me, since it is already sent over ssl. I feel that I need to encrypt the data stored on my server to keep it safe. What would be the best way to encrypt this data? When I query the user data, must I encrypt the supplied value and compare it to what is stored in the database or must I rather decrypt the database?

Or is it an overkill since only my server application will ever have access to this data?

È stato utile?

Soluzione

It's not overkill to encrypt the private data of your users, customers, etc on your filesystems. For one thing that hard drive will eventually end up out of your control --- and it's extremely unlikely that you're going to properly destroy it after it seems to be non-function, even though there's a bunch of private data on it and potentially accessible to someone with a modicum of data recovery expertise and initiative.

I'd suggest PyCrypto.

The real challenge is how you'll managed your keys. One advantage of PK (public key) cryptography is that you can configure your software with the public (encrypting) key in the code and exposed ... that's sufficient for the portions of your application which are storing the data. Then you need to arrange a set of procedures and policies to keep the private key private. That means it can't be in your source code nor your version control system ... some part of your software has to prompt for it and get it (possibly typed in, possibly pushed in from a USB "keyboard emulator" or other password/key vault device).

This has to be done for every restart of your server software (that need to read back this customer data) ... but this can be a long running daemon and thus only need this a few times per year -- or less. You might use something like a modified copy of the ssh-agent to decouple the password management functionality from the rest of your application/server.

(If you wondering where there's value in keeping the private key in memory if it's always in memory when the machine is running --- consider what happens if someone breaks in and steals your computer. In the process they'll almost certainly power it off, thus protecting your data from the eventual re-start. One option, though weaker, is to use a small USB drive for the private key (password/passphrase) storage. This is still vulnerable to the risk of theft, but less of a problem when it comes to your eventual drive disposal. Hard drives are relatively hard and expensive to properly destroy --- but physically destroying a small, cheap USB drive isn't difficult at all).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top