Long story short, I lost a GPG key which I used to encrypt some sensitive stuff. Hopefully, I got some files encrypted two times, one with the key I lost, and one with one I still got.

My question is simple: knowing some decrypted data, can I recover in any way the private key I lost using one or many of those files?

1 Answer 1


I’m sorry for you but no, you cannot.

Your public key is (meant to be) public, so anyone should be able to generate thousands of files encrypted for your private key. If it were possible to deduce the private key from matching cleartext and encrypted file, then the encryption scheme would be (very) weak.

  • Even with multiple cleartext/encrypted files ? Apr 9, 2017 at 16:34
  • 1
    @LucienHaurat Yes. As I wrote, that would be a huge vulnerability since anyone can create thousands or millions of pairs of cleartext and encrypted file. Apr 9, 2017 at 16:51
  • Ok, I didn't see it that way, now I understand ! Thanks ! Apr 9, 2017 at 16:53
  • No problem, and sorry for your private key. :-( Apr 9, 2017 at 16:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .