How can I remove "Real name" from my PGP key?

1

I use GnuPG and, as it was mentioned in this answer, the mail address can be left out of a user ID when edited through the command line interface.

Is there any way - even if it means using a manual hack, a third-party tool or anything else - to remove/skip filling the "Real name" field?

Sutarbi Dudek

Posted 2017-08-13T17:40:39.150

Reputation: 13

Do you want to remove the name from an existing key or create a new one without it? Technically, this is no problem at all: The PGP key format contains just a UID field which is not required to abide by any particular format (such as the usual "Real Name email@address.tld").

– None – 2017-08-13T18:04:38.250

Answers

4

OpenPGP user IDs as defined in OpenPGP 4880, OpenPGP, 5.11. User ID Packet (Tag 13) are formed by arbitrary strings, "Real Name (Comment) " is not more than a convention. Following the specifications, it even may be the empty string.

5.11. User ID Packet (Tag 13)

A User ID packet consists of UTF-8 text that is intended to represent the name and email address of the key holder. By convention, it includes an RFC 2822 [RFC2822] mail name-addr, but there are no restrictions on its content. The packet length in the header specifies the length of the User ID.

GnuPG (at least in version 2.1, which I used to verify this statement) does not enforce a name, either -- just omit any content. In fact, GnuPG actually seems to support empty-string user IDs!

gpg> adduid
Real name: 
Email address: mail@example.org
Comment: 
You selected this USER-ID:
    "mail@example.org"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? 

Not all versions of GnuPG allow free-form user IDs by default and require --allow-freeform-uid. From man gpg:

--allow-freeform-uid

Disable all checks on the form of the user ID while generating a new one. This option should only be used in very special environments as it does not ensure the de-facto standard format of user IDs.

Jens Erat

Posted 2017-08-13T17:40:39.150

Reputation: 14 141

Thank you. This indeed works in 2.1, my problem was that I was using GnuPG 2.0.35. That version (and I suspect most versions before) don't let the user pass without entering a minimum of 5 characters.

(GUIs like GPA or Kleopatra don't allow skipping these, regardless of GnuPG version.)

To tie in to @yyyyyyy's comment: I couldn't create a key with such a fully emtpy uid, but I could add it to a key which already had a uid and then delete the old one (deluid). – Sutarbi Dudek – 2017-08-14T22:06:08.143

You're right, I can verify this at least using GnuPG 1.4 and did not find a way around this. I guess using GnuPG 2.1 should work out as a solution in most cases. – Jens Erat – 2017-08-17T19:41:45.827

@SutarbiDudek: Have a look at --allow-freeform-uid which allowed non-, also listed in GnuPG's manpage. I added some notes in the answer. – Jens Erat – 2017-09-09T19:23:24.153