I was thinking about end-to-end encryption for my chat application, but I am struggling to understand how do I migrate my private keys from one device to another.

One option I thought is to store private keys somewhere very secure (which I can't imagine of), but it will expose the privacy...

Another option is to do something with the password to encrypt messages...

Is there anyone who can help with or make any suggestions how to implement end-to-end encryption with a possibility for users to start using same app on another device or similar?


If you have a mobile application, you can store the private key securely using Android or iOS secure storage.

On your application, you could create a configuration option to export the private key, encrypting the key and showing a QR-Code or something like that. You then would scan the code on the other device, enter the password to decrypt, and import.

  • Wow! That's so smart! Thanks @ThoriumBR – Andrey Ruzhencev Aug 1 at 15:05
  • by the way, what happens if the device is lost? – Andrey Ruzhencev Aug 2 at 16:52
  • Keep the private key password-protected, so if someone finds the phone, the private key is protected. User will have to create another account, sync with his contacts again. Not a problem, is what happens on Whatsapp when you change devices. Or export the private key and user backs it up somewhere. – ThoriumBR Aug 2 at 17:14

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.