Rsa Algorithm

Preview:

Citation preview

RSA ALGORITHM(DOUBLE ENCRYPTION)By

B. Srinivas (104219)

Outline

Introduction Modular arithmetic property Modular multiplicative inverse Euclidean algorithm Modular exponentiation RSA Algorithm Double Encryption Security of RSA

INTRODUCTION

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.

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

, (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)

nxa mod1

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. The Euclidean algorithm makes repeated use of

equation

gcd(a, b)=gcd(b, a mod b)

Euclidean algorithm

The Algorithm has the following progression

3333

2222

1111

*

*

*

rqba

rqba

rqba

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).

m)(bc e mod

Memory-efficient method:

Method to compute modular exponentiation1. set c=1,i=02. increase i by 13. set c=(c*b)(mod m)4. if i < e, go to step 2.Else, c contains the correct

solution to c=be(mod m)

RSA Algorithm

The RSA algorithm involves three steps:1. key generation2. Encryption3. 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.

The keys for the RSA algorithm are generated the following way:

1.Key Generation

1. 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.

1.Key Generation

3. 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.

1.Key Generation

5. Determine d = e–1 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. Encryption

c=Encrypt(m, e, n)

Alice

Public key {e , n}

Encrypted message , c

Bob

m=Decrypt(c, d, n)

Public key={e ,n}Private key={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 :

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

n)(mc e mod

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

-where n is the modulus (from public key) and d is the private key.

n)(cm d mod

Double Encryption

E

1K

E

2K

X

Encryption

mc

2K 1K

cD D

Xm

Decryption

Double Encryption

Double encryption has two encryption stages. Given a plaintext p and two encryption keys k1 and

k2, cipher text c is generated as

Decryption requires that the keys be applied in reverse order.

)),(,( 12 mkEkEc

)),(,( 21 ckDkDm

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 key must not be shared with anyone, so the problem of transmitting it does not arise.

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 and the server and PGP(Pretty Good Privacy) for sending messages.

Security of RSA

Four possible approaches to attacking the RSA algorithm are as follows

1. Brute force: This involves trying all possible private keys.

2. Mathematical attacks: Effort to factoring the product of two primes.

3. Timing attacks: These depend on the running time of decryption algorithm.

4. Chosen cipher text attacks: This type of attack exploits properties of the RSA algorithm.

RSA Usage

RSA is used in security protocols such as; IP data security Transport data security (web) Email security Terminal connection security Conferencing service security

Conclusion

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.

References

Cryptography and network security (4th edition) by William Stallings.

RSA Algorithm-Wikipedia.

Recommended