Introduction
Throughout human history, there is an array of revolutionary technological innovations. One such innovation is cryptography that brought about a revolution in the society by facilitating privately encrypted messages. I got very much interested in this technology after learning that all the secured data transaction is encrypted. There are majorly two basic types of encryption used asymmetric and symmetric key encryption.
What is RSA encryption?
Symmetric key encryption has one weakness that its integrity is dependent on the exclusive sharing of its private keys. Here, different encryption scheme is needed that is asymmetric or public key encryption. Public key cryptography is a mathematical approach valuable in sending information through insecure channels, where the key and the algorithm for encryption and decryption vary from each other (Lin 7; Ambedkar and Bedi 242). RSA algorithm is a very simple public key encryption algorithm. It was firstly described in 1977, by Rivest, Shamir and Adleman. This method endows with an execution of a public key cryptosystem, a neat and simple concept introduced by Die and Hellman, but they did not give any practical implementation of it (Rivest, Shamir and Adleman 121). Security of RSA depends on the integer factorization problem, a renowned theme of research within both academia and industry, as well. When a message is about to be encrypted, it is taken as one large number. In the encryption the large number is increased to the power of the key, and then it is divided by the remainder of a fixed product of two primes. On repeating the process with other key, the plaintext is possible to retrieve back.
RSA in today's world
Encryption is a standard mode of depicting a message privately. The sender enciphers each message before forwarding it to the recipient and the only recipient knows the deciphering code applicable to the message to extract the original information. The large volume of sensitive and confidential information stored in computer systems needs such encrypted security prominently. It has become most successful encryption system today. The concept of public and private key enables this asymmetric cryptosystem in a wide range of functions, as it is highly recommended for digital signatures (Barrett).
RSA algorithm is applied in internet banking and credit card transactions worldwide, to assure security. It is also useful TV satellite smart cards to ensure that only subscribers will be able to receive broadcasts.
A Simple example of RSA Encryption
Here we show an example of encryption and decryption using RSA, the parameters used are small as the purpose is to depict the functioning in a simple manner.
1. Take two distinct prime numbers, p = 61 and q = 53
2. Compute n=p*q. such that n=3233
3. Compute the totients of product.
φ(n)=(p−1)⋅(q−1)
φ (n) = φ (p.q) = φ (61*53) = (61-1)*(5301) = 3120
4. Choose any number 1 < e < 3120 such that e is co-prime to 3120, say e = 17
5. Now compute, d such that d is multiplicative inverse of e
d*e ≡ 1 (mod φ (p*q))
d = 2753 [17 * 2753 = 46801, 46801 mod 3120 = 1]
Public Key: (n,e) = [3233, 17]
Encryption function is c = me mod n
Private Key: (n,d) or (2753)
Decryption function is m = cd mod n
Applying the above keys on a message text: Plaintext: m = 65
Encrypted text: c = 6517 mod 3233 = 2790
Decrypted text: m = 27902753 mod 3233 = 65
This is a very simple example while the real world examples will be much complex. A high speed computer can encrypt a 200-digit message m in a matter of few seconds. (Lin 22)
Understanding RSA Algorithm
In a 'public key cryptosystem' there is a public file encryption procedure E. The user keeps with himself the decryption key D. This procedure of encryption and decryption will have below properties
1. E and D are easy to compute
2. E is publically revealed, but that does not reveal D. This means that an encrypted message with E can only be decrypted with knowledge of D.
3. Decrypting the encrypted text yields M
D(E[M]) = M
4. If a message M is first deciphered, and then encrypted then the result is again M.
E(d[M]) = M
The Mathematics behind RSA
The correctness of deciphering algorithm uses Euler method, for any integer message M, chose n so that n is relatively prime to M
M φ (n) = 1 (mod n) where {mod n} is modulus of n
φ (n) is known as Euler’s Totient or Phi function, φ (n) is an arithmetic function that calculates or counts all the positive integers that are equal to or less than n, and are relatively prime to n. (Rivest, Shamir and Adleman 126)
So for prime numbers p
φ (p) = p - 1.
φ (n) = φ (p). φ (q)
= (p-1).(q-1)
= n - (p+q) + 1
RSA consists of two types of algorithms:
Key Generation: An algorithm for generation of key.
Decryption and Encryption Function: A function that takes input x and key k and using these two produces an encrypted result or decrypted result.
RSA uses a public key and a private key.
Key Generation: The key generation involves below steps
1. Large Prime Number: Two large prime numbers are generated say p and q.
2. Modulus: n is generated by multiplying the numbers p and q
3. Totient: The totient of n φ (n) is then calculated. This is calculated as φ (n) = (p – 1).(q-1)
4. Public Key: It is a key-value pair of e and n i.e., (e,n) where 1 < e < φ (n) and the greatest-common-divisor (gcd) of e and φ (n) is 1, such that both are prime to each other.
5. Private Key: The multiplicative inverse of public key with respect to φ (n) is the private key and is represented as a pair (d, n) where d is the notation for the private key.
Relation of RSA with Fermet’s Theorem
Fermat’s Little Theorem is like the heart of RSA cryptosystem, a slight generalization of the theorem leads to the RSA public key encryption method.
Fermat's little theorem affirms that for any prime number p, and an integer a, the obtained number ap − a should be an integer multiple of p, this is expressed as
ap = a (mod p)
If a can't be divided by p, then Fermat's little theorem states that ap − 1 − 1 is integer multiple of p:
ap-1 = 1 (mod p).
Euler’s Extension of Fermat’s little theorem states that If gcd(a, n) = 1, then
aφ(n) ≡ 1 (mod n).
This extension is the basis of the RSA public-key cryptosystem.
RSA and Chinese remainder theorem
The Chinese remainder theorem is a result of similarity between number theory and abstract algebra. This theorem, was given by a chinese mathematician Sun Tzu, and it was firstly published in 3rd-5th century.
In its nascent form, the Chinese remainder theorem will resolve a number n which if divided by some given divisor leaves given remainders.
A large number of attacks happen against plain RSA, for example, When encrypting with low encryption exponents. For better results crypto libraries in OpenSSL, Java and .NET use optimization techniques for decryption, based on the Chinese remainder theorem.
Encryption
The function for encryption comes to be F (m, e) = me mod n = c, where m is the message for encryption, e is public key and c is the cipher used.
Decryption
The function for decryption comes to be as F(c,d) = cd mod n = m, where d is the private key.
Now there can be two cases
Encryption using public key and decryption using private key or vice-versa.
Real world example of RSA Encryption
In the previous section I illustrated a simple example of RSA encryption decryption, now let’s have a look at more real world example and encrypt the message "hello world". First convert this message into numeric format this can be done easily by converting each letter into ascii format 104101108108111032119111114108100 (American Standard Code for Information Interchange based on English alphabets)
Key Generation
Take two prime numbers p = 61 and q = 53. With these two prime numbers we calculate n and φ (n).
n = p·q =3233
φ (n) = φ (p-1·q-1) = (61-1)·(5301) = 3120
Public key e = 17 (17 has a gcd of 1 with φ (n))
Private key d, d = 2753 (since 17 · 2753 = 46801 and 46801 mod 3120 = 1)
Public Key: (n,e) or (3233, 17)
Private Key: (n,d) or (2753)
Encrypted text (numeric value): c = (104 101 108 108 111 032 119 111 114 108 100)17 mod 3233 = 2170 1313 745 745 2185 1992 1107 2185 2412 745 1773
Decrypted text (numeric value): m = (2170 1313 745 745 2185 1992 1107 2185 2412 745 1773)2753 mod 3233 = 104 101 108 108 111 32 119 111 114 108 100
Conclusion
RSA is an encryption algorithm that has passed the test of time. Its public and private key concept makes it the most consistent algorithm in the context of security. RSA allows user to have a secure and confidential communication. It is found difficult to break the code by factorization techniques. The elapsed time against digits in prime factors is comparatively less and the speed of the computation the prime factor is more which makes RSA a reliable algorithm. Currently, RSA encryption function is the only best known aspirant for one-way permutation.
Therefore, the RSA is a fairly easy, fast and reliable method.
Work Cited
Ambedkar, B. R., and S. S. Bedi. "A New Factorization Method to Factorize RSA Public Key
Encryption." International Journal of Computer Science Issues (IJCSI) 8.6 (2011).
Barrett, Paul. "Implementing the Rivest Shamir and Adleman public key encryption algorithm on
a standard digital signal processor." Advances in cryptology—CRYPTO’86. Springer
Berlin Heidelberg, 1987.
Lin, Franck. "Cryptography’s Past, Present, and Future Role in Society."
Rivest, Ronald L., Adi Shamir, and Len Adleman. "A method for obtaining digital signatures and
public-key cryptosystems." Communications of the ACM 21.2 (1978): 120-126.