RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

11
RSA Encryption Darci Miyashiro Math 480 April 29, 2013

Transcript of RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

Page 1: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

RSA Encryption Darci MiyashiroMath 480April 29, 2013

Page 2: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

What is Cryptography?• Keeping info. secure from unintended

audiences▫Secure electronic transactions, wireless

communications, passwords, etc.

• Encryption: plaintext ciphertext • Decryption: ciphertext plaintext

• Key-based encryption:▫Secret▫Public

Page 3: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

Secret Key(Symmetric)

• 1 Key = encrypt & decrypt▫ Advantage: Fast▫ Disadvantage: Not safe

• Two separate keys▫ 1 public key to encrypt▫ 1 private key to decrypt

Public Key (Asymmetric)

Page 4: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

AliceBob

Message: Hello

Message: 13472

Message: Hello

Encryption key

Decryption Key

Page 5: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

RSA Encryption •Rivest, Ron Shamir, Adi Adleman, Leonard

•Most commonly used cryptosystem

•“Trap door function”

Easy

Hard

EasyTrap Door

Page 6: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

Prime Numbers

•Given two large prime numbers, p and q, we already know:▫Simple: Find product N, where N= p*q▫Difficult: Factor N, when p and q are

unknown

203477=283 * 719

439 * 541 = 237499Easy

Hard

Page 7: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

Generating KeysPublic Key Private Key

• Let n = p* q

• Choose e such that gcd(e, Φ(n))=1

• Choose two large prime integers p,q

• Find Φ(n)=Φ(pq) =Φ(p)*Φ(q)= (p-1)(q-

1)

• Find d such that d is multiplicative inverse of e(modΦ(n))

▫ de 1(mod Φ(n))≣

Page 8: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

•Encryption Function:

•Decryption Function:

E(M) = M e (modn)

D(C) =Cd (modn)

M = Plaintext C = Ciphertext

p,q = prime #’s n = p*q

e: gcd(e, Φ(n))=1 d: de 1(mod ≣Φ(n))

Page 9: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

Example

•Message: “Hi” = 89

•p = 11 q = 13

•n = 11 * 13 = 143

• Φ(143) = (11 – 1)(13 – 1) = 120

•Set e = 7

•d = 103

Page 10: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

AliceBob

Public Key n = 143e = 7

Hi

Secret Keyp = 11 p = 13 Φ(n) = 120 d = 103

Hi = 89

897(mod143) = 67

E = M e (modn)

67

D =Cd (modn)

67103(mod143) = 89

89 = Hi

6789Hi

Page 11: RSA Encryption Darci Miyashiro Math 480 April 29, 2013.

Conclusion• Security relies on difficulty of factoring large

#’s▫Simple idea -> Sophisticated algorithm

• Standard public key = 1024 bits…that’s 309 digits!RSA-1024:

135066410865995223349603216278805969938881475605667027524485143851526510604859533833940287150571909441798207282164471551373680419703964191743046496589274256239341020864383202110372958725762358509643110564073501508187510676594629205563685529475213500852879416377328533906109750544334999811150056977236890927563