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?


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.

| improve this answer | |
  • Even with multiple cleartext/encrypted files ? – Lucien Haurat Apr 9 '17 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. – user2233709 Apr 9 '17 at 16:51
  • Ok, I didn't see it that way, now I understand ! Thanks ! – Lucien Haurat Apr 9 '17 at 16:53
  • No problem, and sorry for your private key. :-( – user2233709 Apr 9 '17 at 16:54

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.