**Cryptography Tutorials - Herong's Tutorial Examples** - Version 5.35, by Dr. Herong Yang

How Secure Is RSA Algorithm?

This section discusses the security of RSA public key encryption algorithm. RSA private key is not 100% secure. But if the private key uses larger value of n = p*q, it will take a very long time to crack the private key.

The security of RSA public key encryption algorithm is mainly based on the integer factorization problem, which can be described as:

Given integer n as the product of 2 distinct prime numbers p and q, find p and q.

If the above problem could be solved, the RSA encryption is not secure at all. This is because the public key {n,e} is known to the public. Any one can use the public key {n,e} to figure out the private key {n,d} using these steps:

- Compute p and q by factorizing n.
- Compute m = (p-1)*(q-1).
- Compute d such that d*e mod m = 1 to obtain the private key {n,d}

If n is small, the integer factorization problem is easy to solve by testing all possible prime numbers in the range of (1, n).

For example, given 35 as n, we can list all prime numbers in the range of (1, 35): 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, and 31, and try all combinations of them to find 5 and 7 are factors of 35.

As the value of n gets larger, the integer factorization problem gets harder to solve. But it is still solvable with the use of computers. For example, the RSA-100 number with 100 decimal digits, or 330 bits, has been factored by Arjen K. Lenstra in 1991:

RSA-100 = 15226050279225333605356183781326374297180681149613 80688657908494580122963258952897654000350692006139 p*q = 37975227936943673922808872755445627854565536638199 * 40094690950920881030683735292761468389214899724061

If you are using the above RSA-100 number as n, your private key is not private any more.

As of today, the highest value of n that has been factored is RSA-678 number with 232 decimal digits, or 768 bits, factored by Thorsten Kleinjung et al. in 2009:

RSA-768 = 12301866845301177551304949583849627207728535695953 34792197322452151726400507263657518745202199786469 38995647494277406384592519255732630345373154826850 79170261221429134616704292143116022212404792747377 94080665351419597459856902143413 p*q = 33478071698956898786044169848212690817704794983713 76856891243138898288379387800228761471165253174308 7737814467999489 × 36746043666799590428244633799627952632279158164343 08764267603228381573966651127923337341714339681027 0092798736308917

As our computers are getting more powerful, factoring n of 1024 bits will soon become reality. This is why experts are recommending us:

- Stop using RSA keys with n of 1024 bits now.
- Use RSA keys with n of 2048 bits to keep your data safe up to year 2030.
- Use RSA keys with n of 3072 bits to keep your data safe beyond year 2031.

*Last update: 2013.*

Table of Contents

Introduction to AES (Advanced Encryption Standard)

DES Algorithm - Illustrated with Java Programs

DES Algorithm Java Implementation

DES Algorithm - Java Implementation in JDK JCE

DES Encryption Operation Modes

PHP Implementation of DES - mcrypt

Blowfish - 8-Byte Block Cipher

Secret Key Generation and Management

Cipher - Secret Key Encryption and Decryption

►Introduction of RSA Algorithm

What Is Public Key Encryption?

RSA Public Key Encryption Algorithm

Illustration of RSA Algorithm: p,q=5,7

Illustration of RSA Algorithm: p,q=7,19

Proof of RSA Public Key Encryption

Efficient RSA Encryption and Decryption Operations

Proof of RSA Encryption Operation Algorithm

RSA Implementation using java.math.BigInteger Class

Introduction of DSA (Digital Signature Algorithm)

Java Default Implementation of DSA

Private key and Public Key Pair Generation

PKCS#8/X.509 Private/Public Encoding Standards

Cipher - Public Key Encryption and Decryption

OpenSSL Introduction and Installation

OpenSSL Generating and Managing RSA Keys

OpenSSL Generating and Signing CSR

OpenSSL Validating Certificate Path

"keytool" and "keystore" from JDK

"OpenSSL" Signing CSR Generated by "keytool"

Migrating Keys from "keystore" to "OpenSSL" Key Files

Certificate X.509 Standard and DER/PEM Formats

Migrating Keys from "OpenSSL" Key Files to "keystore"

Using Certificates in IE (Internet Explorer)