https://samnot.es/rsa/asymmetric-encryption/

Part of my series explaining the RSA Algorithm Asymmetric encryption, also known as public-key encryption, is a popular method for exchanging private information between individuals, which has become more and more important in the world of digital cryptography. To begin, we’ll discuss the problems that asymmetric encryption solve. Later, we’ll get into the weeds of how it works. In the past few months I’ve written a lot about Number Theory. I thought it about time that we put all of this knowledge to some use. So today we’re going to tackle one of Number Theory’s most relevant application domains: cryptography.

Sam

# rsa / Asymmetric Encryption: What is that?

Part of my series explaining the RSA Algorithm

Asymmetric encryption, also known as public-key encryption, is a popular method for exchanging private information between individuals, which has become more and more important in the world of digital cryptography.

To begin, we’ll discuss the problems that asymmetric encryption solve.

Later, we’ll get into the weeds of how it works.

In the past few months I’ve written a lot about Number Theory. I thought it about time that we put all of this knowledge to some use. So today we’re going to tackle one of Number Theory’s most relevant application domains: cryptography.

What is encryption?

Encryption is a mechanism for hiding the meaning of information by expressing it in a non-readable way. In order to read it, the information must be decrypted. The process of encryption usually takes the form of mutating data in some way. Decryption can only be achieved with an awareness of the encryption process used.

The purpose of these cryptographic steps is to ensure that only intended parties can read the enclosed information. Since the invention of secrecy people have found ways to convey their meanings without others being able to intercept, however the dawn of the computer age has made these issues more acute.

The Caesar’s Cypher is two millennia old. It was used so that the Emperor could communicate without the messenger reading the message. The model of a message being transmitted from sender to recipient, on horseback or along fibre-optic cables, remains the same. The medium of transmission cannot be trusted. Interception is a real risk. This is why we need encryption.

Symmetric Encryption

Symmetric encryption is the better known method of encryption. The same key that encrypts the data decrypts the data. Analogous to a door, which is locked an unlocked by different copies of the same key.

The Caesar’s Cypher is symmetric encryption. The encryptor shifts ever letter in the message K letters to the right, in alphabetical terms. K could be any integer, and is the secret key known only by the sender and recipient. If K = 3 then a -> d, b -> e and so on. The message “ABC” becomes “DEF”. The recipient would also know that K = 3. They shift each letter back by 3. d -> a etc. This allows them to decrypt the message “DEF” as “ABC”.

The Caesar’s Cypher is a trivial example. There are only 25 possible keys, and can easily be brute-forced. This issue aside, there is another. The sender and recipient both need to know the key value, K. They cannot send this to each other in a message, or else it could be intercepted, and all following encryption would be compromised.

They would need to meet and physically exchange keys, to be sure that the key isn’t intercepted by someone else. In the past this may not have been a problem. Two spies wishing to use a symmetric encryption method could exchange keys in person before sharing encrypted letters with one another.

In the digital age though, it is not feasible to physically meet and exchange keys each time you need to encrypt data. When you came to this website, TLS encryption took place to keep your use of this site private. You did not need to physically meet me in order for that to work. If you had to do so, your use of the internet would be heavily limited. The purpose of the internet is to enable communication which is location-agnostic.

Asymmetric Encryption

Asymmetric encryption is a method which renders raw key exchange unnecessary. Instead, two corresponding keys are formed, with complimentary mathematical properties. As such, a message encrypted by one key can only be decrypted by the other, and vice versa. Importantly, no key can decrypt its own messages.

The intended recipient creates two such keys. One is chosen as the public key. This can be sent freely across the network to someone that wishes to communicate with this recipient. Using the public key, they encrypt their message and then send it. This message can only be decrypted with the other key, the private key, which the recipient kept for themself. The sender can be sure that only the desired recipient can read their messages.

The enormous benefit here is that the private, decrypting key is never sent or shared. It is kept locally and remains private.

Public Key Interception

An issue that remains though, is that the recipient cannot guarantee who sent this message.

Alice generates a public and private key pair. She sends the public key to Bob. Bob can use the key to encrypt messages and send to Alice. Alice receives those messages and decrypts them. Bob knows that only Alice can read them.

Charlie intercepted Alice’s public key when it was shared across the network. He can now write messages pretending to be Bob. He can encrypt them and send them to Alice. Alice can decrypt those messages and believe Bob is the sender.

Signing Messages

To prevent abuse of public keys, both Alice and Bob can generate a set of key pairs. They each share their public key with one another. When Bob wants to send a message to Alice he will encrypt the message with Alice’s public key as before. He will also add a signature. He might write “Signed by Bob”, and encrypt this with his own private key. This is appended to the end of his message.

When Alice receives this, she can decrypt the message using her private key as before. To verify Bob sent it to her, she can take the signature from the end of the message and decrypt using Bob’s public key. She is able to decrypt this and therefore be sure that the message is definitely from Bob. The same process works when Alice sends Bob a message.

Even if Charlie intercepts both shared public keys, he does not have the private keys necessary to encrypt a signature. Any messages he sends to Alice or Bob can be easily determined as imposters.

How Does It Work?

Now we have a good grasp of the purpose of asymmetric encryption. We need to know how it works next. How can two keys have complimentary properties so that only the other can decrypt its messages?

To understand exactly how RSA works, see the complete guide here.

ARCHIVE

26 Apr 2026 London Marathon: One Year On 15 Apr 2026 A Little Humanity 13 Apr 2026 Hamlet - William Shakespeare 13 Apr 2026 The Rise and Fall of the Third Reich - William L. Shirer 13 Apr 2026 The Secret History - Donna Tartt 11 Apr 2026 A Year of Living Simply - Kate Humble 08 Apr 2026 40 Before 40 08 Apr 2026 Montaigne - Stefan Zweig 04 Apr 2026 William Shakespeare: A Very Short Introduction - Stanley Wells 19 Mar 2026 Unreasonable Hospitality - Will Guidara 15 Mar 2026 Hitler's Secret - Rory Clements 15 Mar 2026 Nemesis - Rory Clements 08 Mar 2026 HRV & Me: Taming a messy stressy mind 02 Mar 2026 Nucleus - Rory Clements 19 Feb 2026 Corpus - Rory Clements 08 Feb 2026 Resonance 16 Jan 2026 A Night to Remember: Sinking of the Titanic - Walter Lord 01 Jan 2026 Everything I've read in 2026 (so far) 15 Dec 2025 Someone from the Past (British Library Crime Classics) - Margot Bennett 01 Dec 2025 Death in Ambush (British Library Crime Classics) - Susan Gilruth 23 Nov 2025 A Cold Wind From Moscow - Rory Clements 10 Nov 2025 The Boleyn Traitor - Philippa Gregory 24 Oct 2025 Death Makes a Prophet (British Library Crime Classics) - John Bude 13 Oct 2025 The Cheltenham Square Murder (British Library Crime Classics) - John Bude 04 Oct 2025 Sussex Downs Murders (British Library Crime Classics) - John Bude 22 Sep 2025 The Lake District Murder (British Library Crime Classics) - John Bude 15 Sep 2025 The Mayor of Casterbridge - Thomas Hardy 10 Sep 2025 The Murder of Roger Ackroyd - Agatha Christie 30 Aug 2025 Marble Hall Murders - Anthony Horowitz 25 Jul 2025 Where Angels Fear to Tread -- EM Forster 10 Jul 2025 Steve Jobs -- Walter Isaacson 10 Jul 2025 The Fifth Risk -- Michael Lewis 10 Jul 2025 The Ride of a Lifetime -- Bob Iger 03 Jul 2025 James -- Percival Everett 01 Jul 2025 Great Expectations -- Charles Dickens 23 Jun 2025 Hillbilly Elegy -- JD Vance 10 Jun 2025 Principles 09 Jun 2025 Revenge of the Tipping Point -- Malcolm Gladwell 06 Jun 2025 The Grand Babylon Hotel -- Arnold Bennett 04 Jun 2025 The Seven Husbands of Evelyn Hugo -- Taylor Jenkins Reid 03 Jun 2025 Rebecca -- Daphne du Maurier 29 May 2025 A Promised Land - Barack Obama 29 May 2025 Less - Andrew Sean Greer 13 May 2025 Careless People - Sarah Wynn-Williams 07 May 2025 Looking Glass War - John Le Carre 04 May 2025 A Murder of Quality - John Le Carre 01 May 2025 London Marathon 2025: Training Retrospective 29 Apr 2025 The Human Factor - Graham Greene 28 Apr 2025 London Marathon 2025: Race Review 27 Apr 2025 Photos: London Marathon 2025 27 Apr 2025 Spectating the London Marathon 2025 [Sunday 27th April] 26 Apr 2025 London Marathon 2025: Week 16 23 Apr 2025 Call for the Dead - John Le Carre 21 Apr 2025 London Marathon 2025: Week 15 16 Apr 2025 The Manchurian Candidate - Richard Condon 13 Apr 2025 London Marathon 2025: Week 14 05 Apr 2025 London Marathon 2025: Week 13 30 Mar 2025 London Marathon 2025: Week 12 26 Mar 2025 Effortless - Greg Mckeown 23 Mar 2025 London Marathon 2025: Week 11 16 Mar 2025 London Marathon 2025: Week 10 09 Mar 2025 London Marathon 2025: Week 9 02 Mar 2025 London Marathon 2025: Week 8 22 Feb 2025 London Marathon 2025: Week 7 16 Feb 2025 London Marathon 2025: Week 6 16 Feb 2025 Problems & [Meta] Problem Solving 14 Feb 2025 Little Dribbling - Bill Bryson 10 Feb 2025 Bring Up the Bodies - Hilary Mantel 09 Feb 2025 London Marathon 2025: Week 5 09 Feb 2025 Three Zero 03 Feb 2025 The iPad mini has genuinely changed my life [no hyperbole] 02 Feb 2025 London Marathon 2025: Week 4 28 Jan 2025 Coming AI: Valuing Humans in a world where they have no economic value 28 Jan 2025 Value & Price 27 Jan 2025 The Vegetarian - Han Kang 27 Jan 2025 Wolf Hall - Hilary Mantel 26 Jan 2025 London Marathon 2025: Week 3 19 Jan 2025 Deriving my own proof for Unitary matrices 19 Jan 2025 London Marathon 2025: Week 2 17 Jan 2025 David Copperfield - Charles Dickens 12 Jan 2025 London Marathon 2025: Week 1 09 Jan 2025 NYC & DC '24 08 Jan 2025 Linear Algebra Playground 07 Jan 2025 Configuring an IKEA wireless light switch: Saving you the pain 07 Jan 2025 Goals & Goal-setting 06 Jan 2025 Digital Feeds 05 Jan 2025 London Marathon 2025: Training Begins 01 Jan 2025 Everything I've read in 2025