RSA Encryption - University of Hawaii at Manoa

Download Report

Transcript RSA Encryption - University of Hawaii at Manoa

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
• Decryption: ciphertext
• Key-based encryption:
▫ Secret
▫ Public
ciphertext
plaintext
Secret Key
(Symmetric)
• 1 Key = encrypt & decrypt
▫ Advantage: Fast
▫ Disadvantage: Not safe
Public Key
(Asymmetric)
• Two separate keys
▫ 1 public key to encrypt
▫ 1 private key to decrypt
Message:
Hello
Message:
13472
Message:
Hello
Decryption Key
Encryption key
Bob
Alice
RSA Encryption
• Rivest, Ron
Shamir, Adi
Adleman, Leonard
• Most commonly used cryptosystem
• “Trap door function”
Easy
Hard
Easy
Trap
Door
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
439 * 541 = 237499
Easy
283 * 719 = 203477
Hard
Generating Keys
Public Key
Private Key
• Let n = p* q
• Choose two large prime
integers p,q
• Choose e such that
gcd(e, Φ(n))=1
• 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))
M = Plaintext
C = Ciphertext
p,q = prime #’s
n = p*q
e: gcd(e, Φ(n))=1
d: de ≣ 1(mod Φ(n))
• Encryption Function:
E(M)  M e (mod n)
• Decryption Function:

D(C)  C d (mod n)

Example
• Message: “Hi” = 89
• p = 11
q = 13
• n = 11 * 13 = 143
• Φ(143) = (11 – 1)(13 – 1) = 120
• Set e = 7
• d = 103
Secret Key
Public Key
n = 143
e=7
p = 11
Φ(n) = 120
D  C d (mod n)
Hi = 89
E  M e (mod n)
67103 (mod143)  89
89 7 (mod143)  67

p = 13
d = 103

89 = Hi


67
Hi
Bob
67
89
Hi
Alice
Conclusion
• Security relies on difficulty of factoring large #’s
▫ Simple idea -> Sophisticated algorithm
• Standard public key = 1024 bits…that’s 309 digits!
RSA-1024:
135066410865995223349603216278805969938881475605
667027524485143851526510604859533833940287150571
909441798207282164471551373680419703964191743046
496589274256239341020864383202110372958725762358
509643110564073501508187510676594629205563685529
475213500852879416377328533906109750544334999811
150056977236890927563