TechTarget.com/searchsecurity

https://www.techtarget.com/searchsecurity/definition/RSA

What is the RSA algorithm?

By Kinza Yasar

The RSA algorithm (Rivest-Shamir-Adleman) is a public key cryptosystem that uses a pair of keys to secure digital communication and transactions over insecure networks, such as the internet.

Public key cryptography, also known as asymmetric cryptography, uses two different but mathematically linked keys -- one public and one private. The public key can be shared with everyone, whereas the private key must be kept secret.

RSA is a type of asymmetric encryption that uses two different but linked keys. In RSA cryptography, both the public and the private keys can encrypt a message. The opposite key from the one used to encrypt a message is used to decrypt it. This attribute is one reason why RSA has become the most used asymmetric algorithm. It provides a method to assure the confidentiality, integrity, authenticity and nonrepudiation of electronic communications and data storage.

RSA was first publicly described in 1977 by Ron Rivest, Adi Shamir and Leonard Adleman of the Massachusetts Institute of Technology. British mathematician Clifford Cocks created a public key algorithm in 1973 that was kept classified by the U.K. Government Communications Headquarters intelligence and security agency, until 1997.

Many protocols rely on RSA for encryption and digital signature functions. These include Secure Shell or SSH, Open Pretty Good Privacy or OpenPGP, Secure/Multipurpose Internet Mail Extensions or S/MIME, and Secure Sockets Layer/Transport Layer Security or SSL/TLS. RSA is also used in software programs, such as browsers, to establish a secure connection over an insecure network, like the internet, or to validate a digital signature. RSA signature verification is one of the most commonly performed operations in network-connected systems.

How does the RSA algorithm work?

Use of the RSA algorithm typically consists of four stages: key generation, key distribution, encryption and decryption:

How does RSA key generation work?

RSA is based on the process of factoring large integers. Its security comes from the difficulty of factoring large integers that are the product of two large prime numbers. Multiplying these two numbers is easy but determining the original prime numbers from the total -- or factoring -- is considered infeasible due to the time it would take using even today's supercomputers.

Generating the public and private key pair is the most complex part of RSA cryptography. Two large prime numbers, p and q, are generated using the Rabin-Miller primality test algorithm. A modulus, n, is calculated by multiplying p and q. This number is used by both the public and private keys and provides the link between them. Its length, usually expressed in bits, is called the key length.

The public key consists of the modulus n and a public exponent, e, which is normally set at 65537, as it's a prime number that isn't too large. The e figure doesn't have to be a secretly selected prime number, as the public key is shared with everyone.

The private key consists of the modulus n and the private exponent d, which is calculated using the Extended Euclidean algorithm to find the multiplicative inverse with respect to the totient of n.

How the RSA algorithm is used: An example

The following is an example of the RSA encryption algorithm in action:

To use RSA keys to digitally sign a message, Alice would need to create a hash -- a message digest of her message to Bob -- encrypt the hash value with her RSA private key, and add the key to the message. Bob can then verify that the message has been sent by Alice and hasn't been altered by decrypting the hash value with her public key. If this value matches the hash of the original message, then only Alice could have sent it, providing authentication and nonrepudiation. A match with the hash also shows that the message is exactly as she wrote it, ensuring integrity.

Alice could provide confidentiality by encrypting her message with Bob's RSA public key before sending it to Bob. A digital certificate contains information that identifies the certificate's owner and also contains the owner's public key. The certificate authority signs the certificates that it issues. Certificates simplify the process of obtaining public keys and verifying the owner.

How secure is RSA?

RSA security relies on the computational difficulty of factoring large integers. As computing power increases and more efficient factoring algorithms are discovered, the ability to factor larger and larger numbers also increases.

Encryption strength is directly tied to key size. Doubling key length delivers an exponential increase in strength. In doing this, though, there is a negative effect on performance. RSA keys used to be 1,024 bits long, but they weren't fully secure against all attacks, and 1,024-bit keys were deprecated in 2013. Since 2013, internet standards and regulatory bodies have banned the use of 1,024-bit keys and advise using RSA keys that are 2,048 bits or longer.

A team of researchers, which included RSA co-inventor Adi Shamir, created a 4,096-bit RSA key using acoustic cryptanalysis. The 4,096-bit keys offer increased data security compared to the 2,048-bit keys, with a slight increase in computational overhead. Security experts have raised concerns that quantum computers will be able to break 2,048-bit RSA keys. The 4,096-bit keys offer greater resistance to such attacks.

However, because of the performance issues, 4,096-bit keys are generally only used in situations where the highest level of security is required. The 2,048-bit keys continue to be the commonly accepted best practice. The National Institute of Standards and Technology deems RSA 2,048-bit keys to be sufficient until 2030.

Barring an unforeseen breakthrough in quantum computing, it will be many years before longer keys are required. Meantime, elliptic curve cryptography is gaining favor with many security experts as an alternative to RSA to implement public key cryptography. ECC can create faster, smaller and more efficient cryptographic keys. For instance, a 256-bit key in ECC delivers approximately the same level of security as a 3,072-bit RSA key.

Modern hardware and software are ECC-ready. It can deliver equivalent security with lower computing power and battery resource use, making it more suitable for mobile apps than RSA. Several cryptocurrencies, such as Bitcoin and Ethereum, already use ECC for key generation and digital signatures.

RSA applications and use cases

RSA has a range of communication and cybersecurity applications. It's compatible with various cryptographic protocols and systems, making it easy to integrate into existing security and communication frameworks.

Common use cases and applications of RSA include the following:

Security vulnerabilities and RSA attacks

While RSA is a widely used and trusted cryptographic algorithm, over the years it has had its share of vulnerabilities. Some security concerns associated with RSA include the following:

Here are some past and potential future attacks on RSA:

How to avoid RSA vulnerabilities

If the RSA algorithm is executed without addressing its vulnerabilities, the encryption will be insufficient to withstand attacks and prevent identity breaches. The latest 2025 RSA ID IQ report reveals that identity breaches are more costly than typical incidents, highlighting the importance of strong encryption.

To enhance RSA security and mitigate its vulnerabilities, organizations should consider the following best practices:

As data volumes and locations expand, strong storage encryption becomes vital for protecting enterprise data. Explore various encryption methods and best practices for securing data.

11 Feb 2025

All Rights Reserved, Copyright 2000 - 2025, TechTarget | Read our Privacy Statement