I working on multiuser project, where users can share data. The data that users upload to the server will be encrypted before it leaves the client with a symmetric cipher, and then the symmentric key is encrypted with a public RSA algorithm to those who the data is ment for (Basic PGP). In this way I can guarantee that unauthorised users don't get access to the data, even if they are able to gain root access to the server.

The question is how should I handle the private RSA keys. By using public-key cryptography the user is very much «locked» to that one devices that contains the private key. But let assume that user wants to switch between smartphone, laptop and desktop. Is it secure to encrypt the private key with symmetric cipher and use PBKDF2 to iterate the password before I upload the private key to a centralized server?

Or is there a better way to share private keys between multiple devices?

  • $\begingroup$ You might opt for a key stretching function that incorporates memory hardness, such as scrypt (in place of pbkdf-2) $\endgroup$ – Ella Rose Feb 25 '17 at 4:53

Technically, yes, it can be secure.

However you are worried about a server compromise. And the consequence of such a compromise would be that the user's private keys can get subject to attack by brute-force and / or dictionary attacks which usually doesn't end well because users tends to pick bad passwords. While you can make this harder using Argon2d (don't use PBKDF2) it's still not impossible for an attacker to even recover a moderately difficult password.

You see the problem now. Because of this I'd suggest leaving the user the choice to sync their encrypted private key to your cloud, to their own cloud service provider, to one of their other devices or don't sync it at all and give them a short explanation.

This will synchronize your private decryption key to our cloud. If you lose this key you will no longer be able to access your encrypted messages. By synchronizing we can also ensure you can use this key from your phone and your laptop. However note that if we get compromised there's a risk that an attacker can recover your password and the key if you're not 100% confident in it. If you don't synchronize there's no risk of a server compromise leaking information about your messages or key.

| improve this answer | |
  • $\begingroup$ That was one of my concerns. Is there other ways this can be done? Like generate separate private keys for each devices and link them together? $\endgroup$ – BufferOverflow Feb 26 '17 at 13:26
  • 1
    $\begingroup$ @BufferOverflow using separate private keys which are linked on an account-level are fine as well. $\endgroup$ – SEJPM Feb 26 '17 at 16:07

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.