Publishing PGP Keys in the DNS

Written 6 years ago by Mike Cardwell

I found out today that it’s possible to publish your public PGP key in the DNS. There is a really good guide at which explains the three different methods in detail. It’s really simple though, so I’ll explain how I did it. I’m going to replace my email address with a fake address to avoid feeding the spambots.

First of all, you need to export your public key and place it somewhere where it can be served via HTTP:

gpg -a --export > /var/www/

In this example, that places the key up at Next, you need to find out your public keys fingerprint (highlighted):

mike@server:~$ gpg --fingerprint --list-keys
pub   4096R/0018461F 2010-11-02 [expires: 2015-11-01]
      Key fingerprint = *35BC AF1D 3AA2 1F84 3DC3  B0CF 70A5 F512 0018 461F*
uid                  Mike Cardwell (Personal mail) <>
sub   4096R/01DE408F 2010-11-02 [expires: 2015-11-01]


Then you simply create a DNS TXT record. The hostname is “” ie, “local_part._pka.domain“ and the value looks like this:


“fpr” is the upper-case value of the keys fingerprint without the spaces, and “uri” is the location of the public key.

So what’s the point of this? This command will automatically fetch the public key of and start encrypting with it:

gpg --auto-key-locate pka -ea -r

If you put “auto-key-locate pka” in your gpg.conf you don’t even need to specify it on the command line. It will automatically look up missing keys in the DNS when it needs to. No need for keyservers.

You can follow this Blog using RSS or . To read more, visit my blog index.

Feeling generous?Bitcoin