A couple of weeks ago I was looking for a way to manage multiple if not all SSH keys within an organization. My primary requirement was a simple way to make all these keys retrievable to everyone inside the organisation. At first I thought about hosting a key server for that organization but then Wiktor on Mastodon mentioned something called “Web Key Directory” which I hadn’t heard about before so I thought I should give it a look 🙂
Web Key Directory or WKD for short is an alternative GnuPG distribution/publishing implemented by GnuPG 2.1.12. Compared to a tradition key-server it allows key owners to publish their keys on their own domain and users to retrieve them from there without having to look them up on some third party.
It does that by exposing public keys through a well-known URL schema. Let’s take the email “firstname.lastname@example.org” as example. A client that supports WKD would now look for a public key to that e-mail address on the following URL:
https://zerokspot.com/.well-known/openpgpkey/hu/<name-hash> name-hash := zbase32(sha1("zerok"))
You can also get the name-hash by running the
with the additional
$ gpg --list-keys --with-wkd email@example.com ... uid [ultimate] Horst Gutmann <firstname.lastname@example.org> email@example.com ...
All that’s left to do is to export the public key to a file using the naming scheme defined above and upload it it:
$ gpg --export KEY_ID > mgaqw3gxp6grwymorjyk99yanaxk1kbu $ scp mgaqw3gxp6grwymorjyk99yanaxk1kbu \ server:/var/www/htdocs/.well-known/openpgpgkey/hu/