
Cryptography – the science of keeping information secret – has a long history, from Roman ciphers to the famous enigma machine used in the Second World War. For centuries all methods of cryptography had a fatal flaw: you and the person receiving your message had to each have a copy of an identical key that opened a metaphorical lock. Then either of you could use this to lock a message in a metaphorical box and send it safe in the knowledge that no one, apart from you and your recipient, could easily access your message. But how do you securely send that key to your recipient in the first place? And if you need to send messages to many different people, you'd need many different sets of locks and keys, one set shared with each potential recipient.
A huge breakthrough came about in the 1970s with the public key cryptography invented independently by Clifford Cocks in the UK and Ron Rivest, Adi Shamir and Leonard Adleman in the USA. This is known as the RSA system (named after Rivest, Shamir and Adleman – Cocks' work was classified until 1997).

RSA relies on a mathematical function that operates like an open padlock. Each person has a personal padlock that they open and publicly share with anyone who wants to send them a message. Then you can send that person a message securely by putting it in a metaphorical box, locking it with the recipient's personal padlock. No sharing of keys is involved – you don't need a key to snap shut an open padlock. Then the recipient can unlock the padlock with their own private key.
The security of these padlocks comes down to a mathematical function that is very easy to do in one direction (equivalent to snapping the padlock shut) but very hard to do in the other direction (ie, opening the padlock). For RSA this hard mathematical problem is factoring large numbers. If you have two large prime numbers (numbers that have no factors apart from 1 and themselves) it is very easy to multiply them together to get an even larger number. But if you were just given the larger number with no other information, it is very hard to find its prime factors, even with the fastest of computers.
(You can read more of the mathematical details about RSA and public key cryptography and factoring numbers here. There are also other mathematical padlocks in use today too, including elliptic curve cryptography.)
With the advent of quantum computing around the corner, we now also need to think about post-quantum cryptography, which you can read about in this article.
This article was produced as part of our collaborations with the Isaac Newton Institute for Mathematical Sciences (INI) and the Newton Gateway to Mathematics.
The INI is an international research centre and our neighbour here on the University of Cambridge's maths campus. The Newton Gateway is the impact initiative of the INI, which engages with users of mathematics. You can find all the content from the collaboration here.

