Top Banner

Click here to load reader

of 26

Rsa Algorithm

Oct 23, 2014



RSA ALGORITHM (Double encryption)5/17/12By Click to edit Master B. Srinivas (104219)

subtitle style


Introduction Modular arithmetic property Modular multiplicative inverse Euclidean algorithm Modular exponentiation RSA Algorithm Double Encryption Security of RSA5/17/12


RSA is a Public key algorithm invented in 1977 by Rivest , Shamir and Adleman (RSA). The RSA scheme is a block cipher in which the plaintext and cipher text are integers between 0 and n-1 for some n. A typical size for n is 1024 bits. Supports Encryption and Digital Signatures.5/17/12

Modular arithmetic property

let a and b be two integers, let op be one of the two binary operators +, or , then the reduction modulo n is an homomorphism of the integers modulo n

(a op b) mod n = [(a mod n) op (b mod n)]modn


Modular multiplicative inverse

The modular multiplicative inverse of an integer a modulo m is an integer x such that 1


x mod n

, (i.e. a x mod n = 1).

The multiplicative inverse of a [0, n 1] modulo n exists iff a and n are co-prime (i.e., if gcd(a, n) = 1)5/17/12

Euclidean algorithm

The Euclidean algorithm computes the greatest common divisor(gcd) of two integers a and n. gcd(a, b)=d means that d is the largest number that will divide both a & b. if gcd(a, b)=1 then we say that a & b are co-prime. 5/17/12

Euclidean algorithm

The Algorithm has the following progression

a1 = b1 *q1 +r1 a2 = b2 * q2 + r2 a3 = b3 * q3 + r3


Modular exponentiation

Modular exponentiation is a type of exponentiation performed over a modulus. Doing a "modular exponentiation" means calculating the remainder when dividing by a positive integer m (called the modulus) a positive integer b (called the base) raised to the e-th power (e is called the exponent). e

c = b ( mod m)


Memory-efficient method:

Method to compute modular exponentiation set c=1,i=0 increase i by 1 set c=(c*b)(mod m) if i < e, go to step 2.Else, c contains the correct solution to c=be(mod m)

1. 2. 3. 4.


RSA Algorithm 1. 2. 3.

The RSA algorithm involves three steps: key generation Encryption Decryption.


1.Key Generation

RSA involves a public key and a private key. The public key can be known to everyone and is used for encrypting messages. Messages encrypted with the public key can only be decrypted using the private key.5/17/12 The keys for the RSA algorithm are

1.Key Generation1. Choose two distinct prime numbers p and q. -For security purposes, the integers p and q should be chosen at random, and should be of similar bit-length. 2. Compute n = p*q. -n is used as the modulus for both the public and private keys.5/17/12

1.Key Generation3. Compute (n) = (p 1)(q 1), where is Euler's totient function. - Euler's totient function (n) defined as the number of positive integers less than n and relatively prime to n. (1) = 1 4. Choose an integer e such that 1 < e < (n) and gcd(e,(n)) = 1, i.e. e and (n) are co-prime.-e is released as the public key exponent.5/17/12

1.Key Generation5. Determine d = e1 mod (n); i.e. d is the multiplicative inverse of e mod (n).-This is more clearly stated as solve for d given (d*e)mod (n) = 1. -This is often computed using the extended Euclidean algorithm.

-d is kept as the private key exponent.


1.Key Generation

The public key consists of the modulus n and the public (or encryption) exponent e. -public key: {e , n}. The private key consists of the modulus n and the private (or decryption) exponent d which must be kept secret. -private key: {d , n}.


2. EncryptionPublic key={e ,n} Private Bob key={d, n}

Alicec=Encrypt(m, e, n)

Public key {e , n} Encrypted message , c

m=Decrypt(c, d, n)


2. Encryption

Encryption is done always with public key. Bob transmits her public key (n , e) to Alice and keeps the private key secret. Alice then wishes to send message to Bob. The message to be encrypted is represented as number m, 0 < m < n - 1. compute :

c = m ( mod n)e

-where the e and n are the public key, and m is the message, c is the encrypted 5/17/12 message.

3. Decryption

The private key d is used to decrypt messages. Bob can recover m from c by using her private key exponent d via computing

m = c ( mod n)d

-where n is the modulus (from public key) and d is the private key.5/17/12

Double EncryptionK1m EX

K2E c


K2c DX



Decrypt ion

Double Encryption

Double encryption has two encryption stages. Given a plaintext p and two encryption keys k1 and = E ( k , E (k ,text c is generated c k2, cipher m)) 2 1 as

m requires k 2 , c the keys be Decryption = D ( k1 , D (that)) applied in reverse order.5/17/12

Advantages of RSA

Simplification of the problem of key management : In symmetric encryption the number of keys required to allow n entities to communicate is proportional to n*n. Whereas in asymmetric encryption each participant needs two keys, therefore, the total number of keys required is simply 2*n. Enhanced security of the transactions : Not only the number of keys reduced but also the security offered by these keys is highly increased. Every user generates a pair of keys. The secret 5/17/12 key must not be shared with anyone, so the

Combining technique

The disadvantage of using public key encryption is that it is a slow process because key lengths are large (1024 bits to 4094 bits) compared to secret key encryption (40 bits to 256 bits). Both the symmetric and asymmetric encryption techniques can be used together to provide better encryption. This combined technique is basically used for Secure Shell(SSH), which is used to secure communication between a client 5/17/12

Security of RSA

Four possible approaches to attacking the RSA algorithm are as follows Brute force: This involves trying all possible private keys. Mathematical attacks: Effort to factoring the product of two primes. Timing attacks: These depend on the running time of decryption algorithm. Chosen cipher text attacks: This type of attack exploits properties of the RSA 5/17/12 algorithm.





RSA UsageRSA is used in security protocols such as;

IP data security Transport data security (web) Email security Terminal connection security Conferencing service security



The encryption and decryption solution can ensure the confidentiality of the information, as well as the integrity of information and certainty, to prevent information from tampering. Encryption and decryption algorithm's security depends on the key confidentiality.



Cryptography and network security (4th edition) by William Stallings. RSA Algorithm-Wikipedia.