How to modify existing key?

There is an existing pgp key with two email adresses included. One of thoses adresses is invalid, the othe remains still valid. In former days removing could be done by ‘PGPkeys’.

How to remove invalid mail adress from key with gpg4win?


[Gpg4win Light 2.2.0, Win7-64b]

As far as I know, there is no way to do this from Kleopatra, so you will need to use gpg from the command line. The program you need is:
C:\Program Files (x86)\GNU\GnuPG\pub\gpg.exe.

[Note: the latest version of the GPG program is actually called C:\Program Files (x86)\GNU\GnuPG\gpg2.exe, but the …\pub folder contains some program “stubs”, one of which is gpg.exe, which when executed calls gpg2.exe. This is just so you can still use the old commands].

This is a little fiddly, but here we go…

In File Explorer, navigate to the …\pub folder, press the Shift key and right-click on the folder, then select “Open command window here”. You should now be in the …\pub folder. Type:

gpg --edit-key userid

where userid is all or part of the key userid; part of the relevant e-mail address usually gets it. For instance, if the e-mail address is, just typing fred999 for the userid should work. Some lines about GnuPG should come up, probably including “Secret key is available.”, and listing the IDs on the certificate, with their trust. The ids are numbered, with a little dot in front of the primary ID name, after (1). You should now be at a gpg prompt, like so:
To select one of the ids, just enter its number, then Return. A star symbol should appear before the selected ID. The number entry is a toggle; if you enter it again, the star will disappear as the entry is deselected.
Now enter deluid, i.e.
gpg> deluid
Confirm that you really want to delete it, then type q to quit:
gpg> q
Confirm that you want to save the changes, then you will be back at the command prompt with the job done. Exit from the command prompt, and check for the change in Kleopatra.

Useful references are:


Thx, it is working!