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?

migrated from crypto.stackexchange.com Aug 14 '17 at 12:44

This question came from our site for software developers, mathematicians and others interested in cryptography.

  • 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>"). – yyyyyyy Aug 13 '17 at 18:04
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.

  • 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 Aug 14 '17 at 22:06
  • 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 Aug 17 '17 at 19:41
  • @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 Sep 9 '17 at 19:23

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.