Let's say I want to make an encrypted message app (just an example). So, I will need a user1 with a password1, private key1 (that will be encrypted with the password1), public key1 (that will depend on private key1), and the data1 (that will be generated in encrypted format by another user2 using the public key1 mentioned before). So, I'm pretty sure I got all this correct (right?). But here comes something I simple can't figure out nor do I able to find an answer online:

What if I need to change my private key1? How in the world would I be able to recover the data1? The reason for this is simple, it might be a case that the password is compromised and as a result the private key, so it must be changed.

Is there really no way around this?


If the private key is compromised the whole key pair is compromised, i.e. the public key should not longer be trusted too. This means that you cannot simply change the private key but must change the whole key pair.

You can still keep the old key pair though in order to deal with the old messages. But given that this key pair is considered compromised nobody should send or accept message any more which are protected by this key pair, i.e. the key has to be revoked for all future use except for dealing with the old messages.


As far as I know, in asymmetric encryption, the private key is generated mathematically (such as DH exchange and RSA). As such, there is no way that I know of where you can change your private key and still uncover the data encrypted by the private key.

You can create an ephemeral key though, this way, if one private key is compromised, the rest of your data would remain safe.

I guess your concern should be placed on protecting your private key.

  • Thanks for the answer, but I can't see how this is solving my problem tbh. The ephemeral key would still be depended upon the password1. The whole idea here is to be able to change sensitive data(password, private key etc) and yet be able to retrieve previously encrypted data(before the change). Protecting the private key is done via encrypting it using the existed password(password1), there's no other practical way of doing this as far as I know(without losing on UX side). – bovubewy Oct 29 '20 at 11:34

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.