Skip main navigation

Differences between symmetric and asymmetric encryption

What are the differences between symmetric and asymmetric encryption schemes, and what are the advantages and disadvantages of each?

Symmetric vs asymmetric

Each of the ciphers that you have seen so far — Caesar, Vigenère, and Vernam — have been symmetric encryption schemes.

Symmetric encryption

In a symmetric encryption scheme, the same key is used to encrypt and decrypt the data. You could think of it like putting a secret into a locked box. The same key will lock and open the box.

A message is put into a box, which is then locked with a key

This type of encryption is great when the same person intends to do the encryption and decryption, for example, encrypting the files on your hard drive.

However, if you want to send a secret message to someone else, they have to have a copy of the key that you used to encrypt the message in order to decrypt the message.

Communicating the encryption key can be difficult, especially if you live far apart, as it risks the key falling into the wrong hands. This is why another form of encryption has become more widely used to facilitate communication, particularly online.

Asymmetric encryption

Asymmetric encryption schemes (commonly known as public-key cryptography) use different keys to encrypt and decrypt data.

The key generation algorithm of an asymmetric encryption scheme generates two keys: one is called the public key and the other is called the private key.

The keys work as a pair. If a message is encrypted with the public key, it can only be decrypted with the private key. This works the other way around as well; only the public key can decrypt messages that are encrypted with the private key.

Animation - Sanjoy creates a pair of keys, and sends one to his friend, Cerys. Cerys types a message to Sanjoy, and uses her key to lock it. Sanjoy uses his key to unlock and read the message. An eavesdropper only sees nonsense.

Public and private keys

Public keys

Suppose that you want to communicate securely with a friend or colleague. You would both generate a pair of keys and share the public keys with each other. When you wanted to send a message, you would encrypt it using the public key, which your messaging partner previously shared with you.

Private keys

If the message is intercepted, the attacker would not have the private key to decrypt the message and it would look like nonsense, even if they tried to decrypt the message using the public key that you used to encrypt the message. When your messaging partner receives the message, they can decrypt it using their private key and read the message.

When they want to reply, they would encrypt the message using the public key that you shared, and you would use your private key to decrypt it.

The benefits of public-key cryptography

A huge amount of the communication happening in the world takes place online. The internet allows us to communicate with people across the world that we have never met.

Sharing a symmetric key across the internet poses some serious security risks — it is relatively easy for an attacker to intercept communications and get the key.

Trusting our online communication

Public-key cryptography allows us to put more trust in our online communication.

This is because we know that the only person who can read a message encrypted with a public key is the person with the private key. If we trust that the other party has not shared the private key with anyone, then we can trust that our communication is secure.

We can prove who we are

Another benefit of these schemes is that we can prove that we are who we say we are. If I encrypt a message with my private key, it can only be decrypted with my public key.

If the decryption works, and you trust that I have not let anyone else access my private key, then you know that it was me who sent the message. We will look at this process in a bit more detail later in the week.

It also allows us to trust corporations with our sensitive information online. Organisations also use public and private keys.

If you want to send them your card details to make a purchase, your computer or browser will use the organisation’s public key to encrypt that information, and only the holder of the private key can decrypt it.

To learn more about encryption and cryptography, check out the full online course, from the Raspberry Pi Foundation, below.

This article is from the free online

Introduction to Encryption and Cryptography

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education