Articles / Cryptography

  • cryptography
  • encryption
  • policy
  • crypto-wars
  • export-controls
  • go

Why Encryption Policy Keeps Forgetting That Maths Has No Border

Here is a complete, working file encryption tool in Go, using nothing but the standard library. It is about thirty lines. No licence, no company, no server, nothing to serve a notice on.

package main

import (
	"crypto/aes"
	"crypto/cipher"
	"crypto/rand"
	"log"
	"os"
)

// usage: enc keyfile < plain > sealed   (keyfile holds exactly 32 random bytes)
func main() {
	key, err := os.ReadFile(os.Args[1])
	if err != nil {
		log.Fatal(err)
	}
	block, err := aes.NewCipher(key)
	if err != nil {
		log.Fatal(err)
	}
	gcm, err := cipher.NewGCM(block)
	if err != nil {
		log.Fatal(err)
	}
	var plain [1 << 20]byte
	n, _ := os.Stdin.Read(plain[:])
	nonce := make([]byte, gcm.NonceSize())
	if _, err := rand.Read(nonce); err != nil {
		log.Fatal(err)
	}
	os.Stdout.Write(gcm.Seal(nonce, nonce, plain[:n], nil))
}

That is deliberately simplified (one read, 1 MiB cap, no key management). The point is the size. Strong encryption is not a product someone ships; it is a recipe anyone can follow.

The recipe is published, so there is nothing to seize

AES, ChaCha20, X25519 and the rest are public standards with public reference code. Any competent programmer can reimplement them, and many languages ship them in the standard library. A rule that applies to companies cannot apply to an algorithm.

So a policy that says "services must be able to read this" is really saying "services in our jurisdiction, that we can reach, must not use the thing that is free everywhere else". Keep that gap in mind; the rest of this post is about who falls into it.

We have already run this experiment

The 1990s Crypto Wars are the case study. The US treated strong cryptography as a munition, so exporting it needed a licence. The results were instructive:

  • Phil Zimmermann released PGP in 1991, it spread worldwide anyway, and the US investigation into him was eventually dropped in 1996.
  • The PGP source was published as a printed book, on the reasoning that books were harder to restrict than software.
  • In Bernstein v. United States, a US appeals court held in 1999 that source code was protected speech. That opinion was later withdrawn when the case was reheard, and the rules were relaxed in 2000 before it was settled, so treat it as influential rather than settled law.
  • Export-grade crypto was deliberately weak, and the weakness outlived the rules.

Quick detour: weak crypto does not stay in its box

Hang on, this bit is properly daft. The 512-bit "export" cipher suites kept existing in TLS libraries and servers for years after they stopped being legally required. In 2015 the FREAK and Logjam attacks showed that a client could be tricked into using them, and breaking them was cheap.

The weakness was meant to be for foreigners only. But a protocol has no idea who is on the other end, so everyone inherited it. That is the maths-has-no-border problem in miniature: you cannot weaken a thing for one audience.

Who a ban actually reaches

If strong encryption is trivially available, a ban or a mandated weakness does not stop the people it is aimed at. They can run the thirty lines above, or any of a hundred open source tools hosted outside the jurisdiction.

What it does reach:

  • Mainstream services with a legal presence, which must comply or leave.
  • Ordinary users who rely on those services and never wrote a line of crypto.
  • Small developers and open source maintainers, who cannot afford to guess how a vague obligation applies to them.

That is my opinion, not a legal finding, but it follows from the mechanics. The people with the most to hide and the most skill are the ones least affected.

Export controls today are narrower than you might think

Controls on cryptography still exist. The Wassenaar Arrangement, a multilateral export control regime, lists encryption items as dual-use, and the UK applies export licensing through the government's strategic export controls. There are exemptions for publicly available software and for mass-market goods, which is roughly why you can download a crypto library without paperwork.

The details depend on the item and the destination, and I have not tried to pin down current licensing thresholds here. If you ship crypto commercially, check the current government guidance rather than trusting a blog post.

The jurisdiction trick that does not work

A tempting reply is that a state can still legislate against the services it can reach, and that is true. Both the UK and others have pursued powers aimed at providers, rather than at the algorithms themselves. That is a coherent enforcement strategy. It just is not the same as controlling encryption.

The honest framing is that such powers regulate which services are convenient, not which communications are possible. Whether that trade is worth the collateral weakening for everyone else is a policy argument, and a fair one to have. But it should be had with the mechanics in view: the protection people lose is the protection of the unsophisticated, while the sophisticated route around it by default.

A better test for any proposal

When you read a new encryption proposal, ask three questions:

  1. Could the thing it targets be reimplemented from a public spec in an afternoon?
  2. If so, who is left to comply, and what happens to their other users?
  3. Can the mandated access be limited to the intended party, or does it work for anyone who finds the mechanism?

The 1990s answered the first one, FREAK answered the third, and neither answer has changed because the maths has not changed. It still fits in thirty lines, and it still does not care where you are standing.