Is there a maximum length for an OpenPGP UID?

Werner Koch wk at
Fri Oct 22 09:40:09 CEST 2010

On Fri, 22 Oct 2010 02:29, expires2010 at said:

> Does it matter how many characters are for "real name," "comment,"
> "email address," or is it just a limit to the total length?

The limit is on the total length:

  /* Cap the size of a user ID at 2k: a value absurdly large enough
     that there is no sane user ID string (which is printable text
     as of RFC2440bis) that won't fit in it, but yet small enough to
     avoid allocation problems.  A large pktlen may not be
     allocatable, and a very large pktlen could actually cause our
     allocation to wrap around in xmalloc to a small number. */

If you create a new user ID which is longer than the limit and you try
to use the key you will get an invalid packet error message.  There are
no checks on the maximum length while creating a user id.  Other
implementations of OpenPGP may have different or no such constraints.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gnupg-users mailing list