jstedfast / MimeKit

A .NET MIME creation and parser library with support for S/MIME, PGP, DKIM, TNEF and Unix mbox spools.

Home Page:http://www.mimekit.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The PGP key server query builder omits leading zero(s) in 'keyId' parameter

khakim0v opened this issue · comments

Describe the bug
It appears that there is an issue with a PGP key server query building. The current format for constructing the request leads to leading zero(s) (if present) of 'keyid' being omitted. Which in turn causes an "Invalid request/Not found" error on a key server. Tested on keys.openpgp.org, keyserver.ubuntu.com and pgp.mit.edu.

Examples:
https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0x04376F3EE0856959 (valid)
https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0x4376F3EE0856959 (error)

Platform:

  • MimeKit Version: 4.5.0

Expected behavior
The format string in code should be updated to "op=get&search=0x{0:X16}" to correctly represent keyId as a fixed-width string of 16 hex digits:

builder.Query = string.Format (CultureInfo.InvariantCulture, "op=get&search=0x{0:X}", keyId);

Released 4.6.0 with this fix