British spies invented the maths behind secure websites, then kept it secret for decades.
Every padlock icon in your browser relies on public-key cryptography, where you can publish a key for anyone to lock messages that only you can unlock. It was announced to the world by American academics in 1976 and 1977. But Britain's GCHQ had already worked it out in the early 1970s, and said nothing until 1997.
For most of history, secret messages needed a shared secret key. Sender and receiver both had to hold it, which meant getting it to each other safely beforehand, and a network of many users needed a separate key for every pair. Public-key cryptography breaks that bind. Each user has a pair of keys: a public one that can be handed out freely, and a private one that never leaves their hands. What one key locks, only the other can unlock.
The trick depends on 'one-way' mathematical problems that are easy to do but very hard to undo. Remarkably, the economist William Stanley Jevons pointed at one in 1874, challenging readers to find which two numbers multiply to give 8,616,460,799 and doubting anyone but him would ever know. Multiplying two large primes is quick; working out the primes from their product is extraordinarily slow. RSA, the most famous public-key system, relies on exactly that difficulty.
The public story begins in 1976, when Whitfield Diffie and Martin Hellman, influenced by Ralph Merkle's work, published a way for two strangers to agree on a shared secret over an open channel. In 1977 Ron Rivest, Adi Shamir and Leonard Adleman at MIT devised RSA, first described in Martin Gardner's column in Scientific American.
Inside GCHQ, however, James Ellis had imagined 'non-secret encryption' in 1970. His colleague Clifford Cocks found a practical method, essentially RSA, in 1973, and Malcolm Williamson developed what we now call Diffie–Hellman key exchange in 1974. The work stayed classified until 1997. Today these ideas secure web browsing, remote logins and software updates, though quantum computers threaten many of them, and replacement schemes are being developed.
Source: Wikipedia — Public-key cryptography · Text summarised from Wikipedia (CC BY-SA 4.0)