A cryptographic desk clock: time transfer protocol
This post is part of a series:
- Part I: protocol for a cryptographic desk clock (this page)
- Part II: time reference
- Part III: agreement protocols
- … sometime in the future … client implementation
Slightly annoying fact: clocks are normally synced with a protocol (NTP, the Network Time Protocol) that provides zero cryptographic guarantees. On the surface this is totally fine, but once we build security-sensitive protocols on top of it (think certificate expiration checks, audit logs or time-bound credentials), we have to turn a blind eye…
Not today! Let’s build a simple cryptographic desk clock to set the House Standard Time in proper cryptographic fashion. Here is the limited edition, mission-critical clock sitting in my home office:

Protocol #
The protocol we’ll be using for clock synchronization is Roughtime. This is a fairly new protocol, introduced in 2016 by Adam Langley (Google). It’s pretty barebones, and simple enough that you can write a client in an evening. So much fun.
Roughtime is essentially a challenge-response protocol. The client sends a random 32-byte challenge to the server, which replies with a signed message containing the client challenge and the current time. (There’s some machinery to make this efficient, like packing requests in a Merkle tree, but that isn’t important now.)
Since you’re probably familiar with NTP, here are the key differences:
| Roughtime | NTP | |
|---|---|---|
| Target time precision | Coarse: ~seconds. Fine for human consumption, certificate expiration | Excellent. Sub-second |
| Security model | Excellent. Architecture tolerates a few actively malicious servers, no SPOF. Network is considered untrusted: packets are cryptographically protected | Bad. Network is assumed trusted (there are some extensions for adding a secure transport layer) |
| Protocol maturity | Very new, although very simple and solid | Gold standard |
| Software/libraries availability | Bad. DIY land, mostly one-off efforts that get abandoned. Mostly targeting beefy machines, almost nothing for embedded targets | Excellent, very mature. Reference implementation has been maintained for 20 years, multiple implementations |
| Software/libraries quality | Good. Mostly written in memory safe languages | Varies a lot |
| Server ecosystem maturity | Very bad. Highly concentrated, few players. Main developer (Google) seems to have abandoned development. Cloudflare runs servers. Google is still offering this without any availability guarantees | Very good. There are global pools of NTP servers. |
| Who uses it? Current deployments | Unclear. Probably a few nerds | Virtually everywhere. time.apple.com, etc |
| Client code complexity | Easy, apart from the crypto | Very easy if high precision isn’t required, high otherwise. Reference implementation is extremely complex: 100k LoC of C |
| Suitable for embedded? | Suboptimal. The public-key signature scheme is Ed25519, which is notoriously RAM-hungry, and it needs SHA-512 code too | Yes |
| History, context, motivation | Introduced in 2016 by Adam Langley (Google) to solve Google’s needs. Little public involvement after initial release | Introduced around 1985 by Dave L. Mills, who kept improving it in a lifelong effort |
| Algorithms | Marzullo, Ed25519, Merkle trees | Marzullo, phase-locked loop |