Publishing OpenPGP Keys via WKD and gpg-wks-client on Ubuntu

Executive Summary

Distributing OpenPGP public keys reliably has evolved beyond legacy, unauthenticated keyservers toward the Web Key Service (WKS) and Web Key Directory (WKD) standards. By hosting key material under a domain’s well-known web tree, organizations can guarantee identity-bound key discovery over HTTPS. This practical guide walks system administrators through provisioning test keys, generating RFC-compliant WKD hash directory hierarchies using gpg-wks-client, and testing key availability on Ubuntu systems.

Setting Up the gpg-wks-client Utility

Begin by synchronizing the local APT repository cache and installing both gnupg and the dedicated gpg-wks-client package to prepare the management workstation.

Install gpg-wks-client and gnupg packages

Verify that the binary operates properly by querying its build configuration and licensing.
The utility acts as an interface for querying WKD endpoints and crafting cryptographic registration requests for mail provider services.
⚙️ [Core Operation Flags]

--supported : Probes DNS and HTTPS endpoints to confirm whether the target domain handles WKD lookups.
--check : Queries the directory for key data mapped to the specified recipient and assesses validity.
--create : Compiles an encrypted submission package requesting key publication from the domain provider.
--receive : Processes verification tokens or administrative replies returned by the receiving provider.
--send : Forwards generated authorization requests directly to the designated mail handler.
--output : Redirects transaction payloads or exported records into a designated file path.
--verbose : Enables detailed operational logging during discovery and transport stages.

Verify gpg-wks-client version output

Provisioning a Disposable OpenPGP Key Pair

Construct a headless test key pair to drive the publishing workflow without interactive prompts by executing gpg --batch --passphrase '' --quick-generate-key '[email protected]' default default.

Generate a test GPG key non-interactively

Examine the generated key ring metadata—including primary key ID, cryptographic fingerprint, and bound subkeys—by running gpg --list-keys '[email protected]'.

Inspect generated OpenPGP public key attributes

Constructing the WKD Hash Store on the Local Filesystem

WKD maps the local-part of an email address into a 32-character Z-Base-32 encoded SHA-1 digest stored beneath a dedicated hu (hash user) directory. Initialize the requisite well-known hierarchy under a temporary web root with mkdir -p /tmp/wkd_root/.well-known/openpgpkey/example.com/hu.

Create required WKD directory structure

Transform the raw public key belonging to [email protected] into the standardized binary WKD hash file and position it in the target tree using gpg-wks-client --install-key '[email protected]' --directory /tmp/wkd_root/.well-known/openpgpkey/example.com.

Deploy binary public key artifact with gpg-wks-client

Inspect the hu directory contents to ensure the hash-named binary object was created with correct permissions by executing ls -la /tmp/wkd_root/.well-known/openpgpkey/example.com/hu.

Confirm generated WKD hash artifact in hu directory

Validating WKS Handshakes and Directory Discovery

Evaluate whether a live public key can be resolved across the web directory for [email protected] via gpg-wks-client --check '[email protected]'.
Because this test environment lacks an active HTTPS daemon serving the /tmp/wkd_root files, the command concludes cleanly without returning published remote payloads.

Probe WKD endpoint with check flag

Determine whether the domain operator (example.com) advertises valid WKS or WKD discovery records by running gpg-wks-client --supported '[email protected]' || true.
Appending || true guards shell execution, preventing premature script exits when interrogating unconfigured test domains.

Audit domain WKD capabilities

Once testing wraps up, purge the staged directory structure and generated binary hashes with rm -rf /tmp/wkd_root.

Purge temporary staging directory

This walkthrough covered staging, formatting, and verifying OpenPGP public key publication through the Web Key Directory architecture on Ubuntu using gpg-wks-client. Deploying this infrastructure across production domains enables modern mail clients to exchange encrypted correspondence automatically without relying on legacy public keyservers.