# RSA

Document Sample

```					                             RSA

in 1976.

Invented by James Ellis and implemented by Clifford Cocks in 1973
Symmetric Cryptography

Using a symmetric scheme, messages are encrypted and
decrypted with the same secret key. The system is only as secure
as the mechanism used to transmit the key.

message                                      message
secret-key                                    secret-key
Bob cipher-text                              Alice cipher-text

cipher-text    secret-key message
Public Key Cryptography
With an asymmetric scheme messages are encrypted with a public
key, which anyone can view and can only be decrypted with a
private key.

message                                      message
public-key                                   private-key
Bob cipher-text                            Alice
cipher-text

cipher-text public-key garbage

The private key never needs to be transmitted
and so the risk of a breech is greatly reduced.
The Public/Private Keys

choose p,q, big primes, (normally, at least 200 digits)

n= p*q

p=5, q=11, n=55
choose e coprime to p and q
e=7
find d such that (e)(d)mod(p-1)(q-1)=1 mention the extended
d=23                   euclidian algorithm and
public key:(7,55)
private key:(23,55)
Public Key Cryptography

The security of RSA relies on the fact that multiplication is a one-way function.

Calculating N = p*q, given p,q can be done in polynomial time.

Cracking RSA requires correctly “guessing” the private key, e.
e cannot be derived from d and n. (p-1)(q-1) is required to
There is no proof that n,q can be derived from P with a polynomial time algorithm.

There is no proof that p,q can’t be derived from N with a polynomial time algorithm.

The security of RSA would be broken if an efficient (Polynomial-time) algorithm were
discovered/invented.
Euler’s Function

Totient: the totient of q is the number of integers < q that are coprime to q.

Φ(8) = 4 because 8 is coprime with {1,3,5,7}

If m < n and m is coprime with n, then
Euler’s Function

15 mod 8=1, 35 mod 8=3, 55 mod 8=5, 75 mod 8=7
Euler’s Function

mΦ(n) + 1 = m(s * Φ(n)) + 1 (mod n)
for positive integers, s.
If we pick e and d so that
(e * d) = 1 (mod Φ(n))
then we have
m = m(s * Φ(n)) + 1 (mod n)
m = m(e * d) (mod n)
m = (me)d (mod n)
m = (me mod n)d (mod n)
A (trivial) example

Encrypt with the message „2‟ with the public key (7,55)

27 mod 55 = 128 mod 55 = 18

Send the ciphertext, 18, to the recipient who will decrypt it with her private key (23,55)

1823 mod 55 = ???
Optimization of Modular Exponentiation

1823 mod 55 = ???

1                  1*18 mod 55 = 18
2                  18 * 18 mod 55 = 49
3                  49 * 18 mod 55 = 2
4                  2 * 18 mod 55 = 36
.
.
.

20                 52 * 18 mod 55 = 1
21                 1 * 18 mod 55 = 18
22                18 * 18 mod 55 = 49
23                 49 * 18 mod 55 = 2
Requires O(e) operations but the largest value we have to deal with is 18*49
Exponentiation by Squaring

We‟ve gone
from 22
multiplications
to 9
A Hybrid Approach

Combining the two methods leads to an algorithm that performs in O(log e)

(e & 1)
while ((e > 0) {== 1) result = (result * b) % m;
if >>= 1;
e = (b * b) % m;
} b result;
return
Questions and Credits

Modular Exponentiation
Wikipedia, April 9th 2007
<http://en.wikipedia.org/wiki/Modular_exponentiati
on>
Loudon, Kyle. Mastering Algorithms with C. Sebastapor, CA:
Oreilly, 1999
RSA
Wikipedia, April 25th 2007
<http://en.wikipedia.org/wiki/RS
A>
Engelfriet, Arnoud. The RSA public key cryptographic
system. 10 October 2005 Ius Mentis
<http://www.iusmentis.com/technology/encryption/rsa/>
Images of Satan courtesy of Warren Croce. http://WarrenCroce.com

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 4 posted: 12/4/2011 language: English pages: 13