GPG Keys getting deleted automatically


I am using the following steps to import keys into GPG

  1. Open prompt and fire import KEY command
  2. Fire --edit-key KEY_NAME
  3. Type trust and type 5 save
  4. Place gpg.conf file at %APPDATA%/Roaming/gnupg and it only has one word '‘batch’

I have two keys

  1. PUBLIC KEY - Used for encrypting files
  2. PUBLIC_PRiVATE KEY PAIR - Used for decrypting files. The public part we use for decrypting files for QA.

We have three jobs - two of them use second key above for decrypting files and one uses first key for encrypting.
The jobs run at a frequency of 15 minutes.

The problem I am facing is that the keys along with gpg.conf file get deleted almost after 24 hours and sometimes randomly.

I would be really grateful if someone can help me here.

Thanks in advance

my next step for analysis would be to find out at which time or occasion the certificates are deleted. I find it unlikely that GnuPG ofr Gpg4win will delete them. If you have the time an occation, try to observe which applications/processes are running.


Hi Bernhard

We have observed that if any error happens on Kleopatra the keys go missing. For example if Kleopatra is opened in other session and we right click a file and ‘Verify and Decrypt’ then it complains that Kleopatra is opened in some other session and when we click on OK on the error window we see that keys get deleted as well as gpg.conf.

Apart from that we had a tough time replicating the issue on demand. We tried all permutations and combinations of running the jobs but none has worked convincingly.

I would be really grateful you if can ask questions that you think would lead me to the problem point.

Are you using Kleopatra in a multi-user environment?
Usually only one uiserver should be started and used (which is Kleopatra)
you should not have two uiservers running on the same set of files.