I found out today that it’s possible to publish your public PGP key in the DNS. There is a really good guide at http://www.gushi.org/make-dns-cert/HOWTO.html 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 firstname.lastname@example.org > /var/www/pgp.pub.asc
In this example, that places the key up at http://example.com/pgp.pub.asc Next, you need to find out your public keys fingerprint (highlighted):
mike@server:~$ gpg --fingerprint --list-keys email@example.com 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) <firstname.lastname@example.org> sub 4096R/01DE408F 2010-11-02 [expires: 2015-11-01] mike@server:~$
Then you simply create a DNS TXT record. The hostname is “mike._pka.example.com” 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 email@example.com and start encrypting with it:
gpg --auto-key-locate pka -ea -r firstname.lastname@example.org
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.
Looking to hire somebody like me? I'm open to offers of full time employment and small contract jobs. Check out my hiring page. You can follow this Blog using RSS or Twitter. To read more, visit my blog index.