RSA Asymmetric Encryption: How It Works

RSA Asymmetric Encryption: How It Works
Table Of Contents

Key Takeaways:

  • Encryption takes readable text and information (known as plaintext) and scrambles it to appear randomized and indecipherable (known as ciphertext) using algorithms.
  • The two methods have one key difference: symmetric uses one key and asymmetric uses two. As you might guess, that second key gives asymmetric encryption its reputation for being the more secure option.
  • RSA is widely known to be extremely secure and is often used to pass sensitive information/data between parties. It is certainly more secure than symmetric encryption algorithms.

In a world where digital privacy has never been more valuable, it’s important to have a baseline knowledge of how various security strategies work. You want to be able to understand the options that exist and how to use them so you can ensure your online activity is as secure as possible. 

Among these digital strategies is encryption, specifically, RSA asymmetric encryption. Read on to learn all about encryption, the two main types (symmetric and asymmetric), and how RSA works. 

What Is Encryption? 

To start, let’s cover what encryption is. It’s a term you may have heard in your favorite action movies when heroes are typing away at their computers and hacking into the mainframe. Despite its seemingly complicated nature, encryption is a topic that even the most basic internet user should have some understanding of. 

The dictionary definition of encryption is: the process of converting information or data into a code, especially to prevent unauthorized access. Essentially, encryption takes readable text and information (known as plaintext) and scrambles it to appear randomized and indecipherable (known as ciphertext). Encryption uses algorithms to do this. 

The only people or platforms that can read encrypted content are those who have the code to decrypt it, making the information once again readable/understandable. The person who can decrypt the content will use a unique digital key. This key comes in the form of a passcode made of characters that is also created by the encryption algorithm. 

The more secure the encryption algorithm, the more passcodes it will need to be decrypted. That way, people can’t simply guess the passcode or try every combination possible until one is correct. Depending on the algorithm, passcodes can include many codes made up of hundreds of computer bits. Good luck hacking your way into that mainframe. 

The main reason encryption exists is to protect data from being stolen, observed by unwanted eyes, changed, or otherwise compromised. It also helps ensure the integrity of documents, data, and other information so everyone stays on the same page. 

Symmetric vs. Asymmetric Encryption

Another key piece to understand when learning how RSA asymmetric encryption works is the difference between symmetric and asymmetric encryption. 

The two methods have one key difference: symmetric uses one key and asymmetric uses two. As you might guess, that second key gives asymmetric encryption its reputation for being the more secure option. 

Symmetric Encryption

Symmetric encryption uses only one encryption key to decrypt information. This means the same key is used to encrypt the data as the recipient uses to decrypt it. This is a less secure option because it’s more likely that unauthorized people will learn the decryption key because it’s the same as the encryption key. 

To solve this security threat, when you send the recipient the passkey, you can always encrypt that message. Encrypting a passkey will be a smaller message size than sending the original note, minimizing the expense and lag times that come with asymmetric encryption. 

But if you use symmetric encryption to do this, it might put you in an endless loop of encrypting and decrypting your own passcodes to boost security. This would significantly slow down the process and make it more complicated for everyone. 

The perks of symmetric encryption algorithms are that they’re generally cheaper to make because they’re simpler. It’s also easier on the computer system to encrypt and decrypt the information.

If you’re looking to send something quickly and don’t want to wait for the possible lag time it takes for a computer to decode an asymmetric encryption, symmetric encryption may be for you, especially if the data you’re sending isn’t super sensitive. 

Asymmetric Encryption 

Asymmetric encryption uses two different keys: one to encrypt the information and a separate one to decrypt it. The first key is known as a public key and, especially in the context of a workplace, is shared among all necessary people. This public passkey is usually very large and can be up to two thousand computer bits in length. 

Anyone with the encryption key can send the message to the recipient. But unlike symmetric encryption, only the recipient can decrypt the message with their second, private key. Those with the encryption key won’t be able to access the content after it’s sent. 

The drawbacks to using asymmetric encryption are that it’s typically more expensive and takes much more computer power to decrypt on the recipient’s end. So, if you have a relatively small, sensitive message to relay to someone, asymmetric may be the way to go. But if you’re sending something large, it will be an expensive and slow process. 

Asymmetric encryption algorithms typically run through a Public Key Infrastructure (PKI). This system facilitates making and sending public and private keys. PKI as a whole uses asymmetric encryption to allow the exchange of information mostly in the context of online communication. PKI comes included in most browsers like Google. 

What Is RSA Asymmetric Encryption? 

As you can infer from above, RSA asymmetric encryption is a common encryption algorithm that uses the asymmetric method of two passcodes: a public code and a private code. 

RSA is actually one of the original methods of asymmetric encryption. It was created by a team of researchers at MIT in 1977. Their names were Ronald Rivest, Adi Shamir, and Leonard Adleman. Thus, the acronym RSA stands for their last names: Rivest-Shamir-Adleman. 

How RSA Encryption Works

As with all asymmetric encryption algorithms, to use RSA, you’ll follow these three main steps: 

  1. The recipient generates the public and private keys (so only they can know/solve for the private key). They make sure the sender has the public key.
  2. The sender uses the public key to encrypt the data, which then becomes ciphertext that’s impossible to understand, and sends it.
  3. The recipient uses the private key to decrypt the ciphertext, which then becomes legible plaintext. They see the data/message in the form in which it was originally sent.

It’s important to note that it is possible to encrypt the message with the private key and decrypt it with the public key. This will happen when the private key owner responds to the public key owner. But often, the person initiating contact will be the one with the public key. 

What makes any encryption algorithm unique is how the algorithm is set up. Yes, this means math and computer coding. 

For RSA, the public passkey is created by factoring two prime numbers and adding an auxiliary value. The algorithm you use will predetermine your public passkey, but to decrypt the data, the recipient will have to know the base prime numbers used to create the key. 

Bear with us, it’s about to get slightly complicated. But we did promise to explain exactly how RSA asymmetric encryption works. The great thing to keep in mind is that if you use RSA, you won’t have to do the math listed below to create the passkeys. The RSA algorithm will do it all for you. 

But if you’re curious about how the cypher works (think of it like decoding a secret message), here are the basics: 

Generate the Key 

  1. Select two prime numbers (numbers that can only be divided by 1 and itself). For now, we’ll use “a” and “b.”
  2. Multiply the two prime numbers, a*b=n. “n” will be used for both the public and private keys.
  3. Use Euler’s Totient Function to calculate the value of Φ(n).
  4. The math gets more complex here. We won’t go into specifics, but you will have to choose exponents for both encryption (e) and decryption (d) using mathematical theorems and algorithms.
  5. By the end, the public key will be (n,e) and the private key will be (n,d). 

Remember, the RSA algorithm will generate all of these numbers and perform this math for you. If you’re interested in seeing a more detailed mathematical breakdown, click here.

Encrypt the Data

Now that you have the public and private keys, it’s time to encrypt your message. The data or message you’re sending will likely comprise words/letters that humans can easily read. When you begin the RSA encryption process, the data is converted into a numerical data set using ASCII or other encoding methods. 

From there, you will use the public key (n,e) to encrypt the message and convert its contents to ciphertext that humans won’t be able to make sense of. A mathematical formula is used to generate the encrypted content. 

Decrypt the Data

Once the recipient gets the data, they will use the private key they generated (n,d) and change the nonsensical ciphertext back into its original readable state. Again, a mathematical formula is used to achieve this. 

What Are the Perks of Using RSA Asymmetric Encryption? 

Even though asymmetric encryption is more costly and slower than symmetric encryption, there are a few benefits it offers that may outweigh these drawbacks: 

Complicated Math

As you’ve seen above, the mathematical configuration behind RSA isn’t something you learn in middle school math class. In fact, the whole reason RSA is mathematically built the way it is is because it’s hard to factorize large numbers. 

You may think that since the mathematical process to create RSA passkeys is public knowledge, someone would be able to solve the formula in reverse and find the original prime numbers, allowing them to solve for the decryption key. But RSA uses such large numbers for the values of those original numbers that it’s impossible to factorize and solve in reverse. 

This means the larger those numbers, the better, because if someone did find “a” and “b,” they could solve for the decryption key and decode the message. 

High Security

Due to the complicated math listed above and its asymmetrical nature, RSA is widely known to be extremely secure and is often used to pass sensitive information/data between parties. It is certainly more secure than symmetric encryption algorithms. 

Signature Capabilities

Using RSA, the person with the private key can sign encrypted messages digitally, and the person with the public key can receive and verify the signature and vice versa. This can be helpful when dealing with sensitive documents. RSA allows you to be absolutely sure the right person had their hands on the right document, confirming it all with their signature. 

What Are the Drawbacks of RSA Asymmetric Encryption? 

Like all technological tools, RSA encryption is not perfect. There are several drawbacks to consider, many of which apply to the majority of asymmetric encryption options:

Slow Speeds

Again, like most asymmetric options, RSA will be slower than other encryption algorithms, especially symmetric ones. If you’re sending a message or data that’s relatively small in size, you’ll be okay. But if you’re sending something large, you will definitely notice the lag time when sending and decrypting the message. 

High Computer Power Required

RSA uses thousands of computer bits in its passkeys and algorithms. This means you will need significant computer power to send and access your message. This also impacts computer storage space and means you will need a strong network with substantial resources. In other words, RSA is better for businesses and corporations than individuals. 

Attack Vulnerability

RSA is more vulnerable than some algorithms to side-channel attacks. This means skilled hackers can potentially gain access to the private key by using information leaked through the system itself, like power consumption and radiation side channels. Quantum computers also pose a threat as they can attack the RSA algorithm. 

Why Is Encryption Important? 

It may seem like this is a pretty complicated process to partake in just for some peace of mind. But the truth is that the tool of encryption is extremely valuable and important. Encryption is also much more widespread than you might think. And it’s not just for corporate use. 

Every time you use a Virtual Private Network like Burner VPN, that’s encryption working to keep your internet connection private and secure. Every time you’re on a website that starts with https://, you’re on a site that’s using encryption. 

Encryption helps protect your information from hackers and cybercriminals, but it also helps keep it away from snooping government agencies, Internet Service Providers who look to collect your data to send you targeted ads, and other prying eyes. 

In a more specific sense, encryption in the context of RSA helps protect the specific data or message you’re sending to the recipient. This means privacy and confidentiality. It ensures only the sender and recipient have eyes on the encrypted content. 

This also helps confirm that the message remains in its original form and can’t be altered by outside parties. And with so many devices in use both in your house and across the world, encryption also helps keep data safe as it moves between phones, computers, TVs, and more. 

FAQs

Is RSA better than AES?

AES is much faster than RSA and is better suited for encrypting large volumes of data. Both offer high security, but the method of use may change based on the needs.

Why is RSA hard to decrypt?

The prime numbers remain confidential. While anyone can encrypt messages using the public key, only those with access to the private key can decrypt them. RSA’s security is based on the challenge of factoring large numbers into their original prime factors, known as the “factoring problem.”

What is more secure than RSA?

The biggest difference between ECC and RSA is the greater cryptographic strength that ECC offers for an equivalent key size. An ECC key is more secure than an RSA or DSA key of the same size.

So, How Does RSA Asymmetric Encryption Work? 

Don’t worry about remembering all the math. The main thing to know about RSA is that it’s an encryption algorithm that uses two separate passkeys. Due to its complexity, RSA is widely considered to be an extremely secure form of encryption, but it is also expensive, slow, and sometimes difficult to use. 

Using tactics like strong passwords, firewalls, second phone number apps like Burner, etc. is the place to start when it comes to cybersecurity. Leave complex encryption for the office unless absolutely necessary. But having a basic understanding of more complicated tools like RSA asymmetric encryption is still extremely valuable and can never hurt. 

Sources: 

So What Does A Modern Encryption Key Look Like? | by Prof Bill Buchanan OBE FRSE | ASecuritySite: When Bob Met Alice | Medium

Euler’s Totient Function | GeeksforGeeks

RSA Algorithm in Cryptography | GeeksforGeeks

ASCII table

DOE Explains...Quantum Computing | Department of Energy

What is a Side-Channel Attack? | Definition from TechTarget

What is encryption and how does it work? | Google Cloud

How many numbers in the encryption key - Google Messages Community

What is Asymmetric Encryption? | IBM

Ready to start calling & texting with a shiny new number?

Get Burner

Scan to download Burner