How DNSCurve Works

DNSCurve is used when both the resolver and remote authoritative server support it. (Otherwise, unencrypted DNS is used.)

How does the resolver know in advance if the remote authoritative server supports DNSCurve? When deploying a DNSCurve-aware server such as CurveDNS, the administrator of the remote authoritative server puts the server's public key into a DNS label. For example instead of calling the nameserver ns1.example.com, it might be called uz5jmyqz3gz2bhnuzg0rr0cml9u8pntyhn2jhtqn04yt3sm5h235c1.example.com.

Here, the DNS label uz5jmyqz3gz2bhnuzg0rr0cml9u8pntyhn2jhtqn04yt3sm5h235c1 begins with the DNSCurve magic string uz5, followed by a 51-byte Base-32 encoded Curve25519 public key. Seeing this, the resolver knows the remote authoritative server supports DNSCurve.

The resolver then computes a shared key using its private key and the remote server's public key. Using that shared key, the resolver encrypts the query using XSalsa20-Poly1305 and sends it, and its own public key, to the remote server.

The remote server decrypts the query using its secret key and the resolver's public key. The authoritative server then encrypts its answer and sends it to the resolver.

DJB has a more detailed description.