SlideShare a Scribd company logo
The RSA Cryptosystem


        Dan Boneh
    Stanford University
The RSA cryptosystem


   First published:
     • Scientific American, Aug. 1977.
              (after some censorship entanglements)




   Currently the “work horse” of Internet security:
     • Most Public Key Infrastructure (PKI) products.
     • SSL/TLS: Certificates and key-exchange.
     • Secure e-mail: PGP, Outlook, …


                                                        Page 2
The RSA trapdoor 1-to-1 function

   Parameters:         N=pq. N 1024 bits. p,q 512 bits.
                        e – encryption exponent. gcd(e, (N) ) = 1 .


   1-to-1 function: RSA(M) = Me (mod N)                    where M ZN*

   Trapdoor:           d – decryption exponent.
                                   Where     e d = 1 (mod (N) )
                                   d                (N)+1
   Inversion:          RSA(M)         = Med = Mk           = M (mod N)

   (n,e,t, )-RSA Assumption:             For any t-time alg. A:

    Pr[ A(N,e,x) = x                                           ]<
                       1/e           p,q R n-bit primes,
                             (N)   :
                                       N pq, x R ZN*
                                                                          Page 3
Textbook RSA is insecure

   Textbook RSA encryption:
    • public key: (N,e)     Encrypt: C = Me (mod N)
    • private key: d        Decrypt: Cd = M (mod N)
                                         (M   Z N* )


   Completely insecure cryptosystem:
    • Does not satisfy basic definitions of security.
    • Many attacks exist.


   The RSA trapdoor permutation is not a cryptosystem !

                                                        Page 4
A simple attack on textbook RSA
     Rando                  CLIENT HELLO
       m
    session-     Web        SERVER HELLO (e,N)     Web      d
     key K     Browser                            Server
                                C=RSA(K)


    Session-key K is 64 bits. View K {0,…,264}
        Eavesdropper sees: C = Ke (mod N) .

    Suppose K = K1 K2 where K1, K2 < 234 . (prob. 20%)
        Then: C/K1e = K2e (mod N)

    Build table: C/1e, C/2e, C/3e, …, C/234e . time: 234
     For K2 = 0,…, 234 test if K2e is in table. time: 234 34

    Attack time:     240 << 264                                Page 5
Common RSA encryption

   Never use textbook RSA.
   RSA in practice:


             Preprocessing         RSA




                                           ciphertext
       msg




   Main question:
    • How should the preprocessing be done?
    • Can we argue about security of resulting system?

                                                         Page 6
PKCS1 V1.5


   PKCS1 mode 2:   (encryption)
     16 bits

      02         random pad             FF   msg

                         1024 bits


   Resulting value is RSA encrypted.

   Widely deployed in web servers and browsers.
   No security analysis !!

                                                   Page 7
Attack on PKCS1

   Bleichenbacher 98. Chosen-ciphertext attack.
   PKCS1 used in SSL:                                 C= ciphertext

                       d             C
             Is this
            PKCS1?        Web                      Attacker
                                  Yes: continue
                         Server
           02                      No: error


       attacker can test if 16 MSBs of plaintext = ’02’.

   Attack: to decrypt a given ciphertext C do:
                                                              e
    • Pick r ZN. Compute C’ = C = (r PKCS1(M)) .
                                     re
    • Send C’ to web server and use response.
                                                                  Page 8
Chosen ciphertext security (CCS)
    No efficient attacker can win the following game:
                 (with non-negligible advantage)


                        M0 , M1


                  C=E(Mb)      b                         Decryption
    Challenger                     R
                                          Attacker         oracle
                   Challenge
                                                                 C
                        b’



                 Attacker wins if      b=b’


                                                                  Page 9
PKCS1 V2.0 - OAEP

   New preprocessing function: OAEP (BR94).
                              M        01 00..0      rand.

                                  +          H
    Check pad
    on decryption.
    Reject CT if invalid.
                                             G        +

                            Plaintext to encrypt   with RSA   {0,1}n-1


   Thm: RSA is trap-door permutation                  OAEP is CCS
       when H,G are “random oracles”.
   In practice: use SHA-1 or MD5 for H and G.
                                                                     Page 10
OAEP Improvements

 OAEP+:   (Shoup’01)          M           W(M,R)       R

   trap-door permutation F         +           H

 F-OAEP+ is CCS when
 H,G,W are “random oracles”.                   G        +



 SAEP+: (B’01)
                                   M        W(M,R)          R
 RSA trap-door perm
 RSA-SAEP+ is CCS when                 +            H

 H,W are “random oracle”.

                                                            Page 11
Subtleties in implementing OAEP                        [M ’00]



          OAEP-decrypt(C) {
               error = 0;

               if ( RSA-1(C) > 2n-1 )
                    { error =1; goto exit; }

             if ( pad(OAEP-1(RSA-1(C))) != “01000” )
           }      { error = 1; goto exit; }


   Problem:    timing information leaks type of error.
               Attacker can decrypt any ciphertext C.
   Lesson: Don’t implement RSA-OAEP yourself …

                                                                 Page 12
Part II:
    Is RSA a One-Way Function?
Is RSA a one-way permutation?

   To invert the RSA one-way function (without d) attacker
    must compute:
               M   from    C = Me (mod N).


   How hard is computing e’th roots modulo N ??

   Best known algorithm:
     • Step 1: factor N. (hard)
     • Step 2: Find e’th roots modulo p and q.     (easy)



                                                        Page 14
Shortcuts?

   Must one factor N in order to compute e’th roots?
    Exists shortcut for breaking RSA without factoring?

   To prove no shortcut exists show a reduction:
    • Efficient algorithm for e’th roots mod N
           efficient algorithm for factoring N.
    • Oldest problem in public key cryptography.


   Evidence no reduction exists:           (BV’98)

    • “Algebraic” reduction          factoring is easy.
    • Unlike Diffie-Hellman (Maurer’94).
                                                          Page 15
Improving RSA’s performance

   To speed up RSA decryption use
    small private key d.        Cd = M (mod N)

    • Wiener87:    if d < N0.25 then RSA is insecure.
    • BD’98:       if d < N0.292 then RSA is insecure
                               (open: d < N0.5 )


    • Insecure: priv. key d can be found from (N,e).

    • Small d should never be used.

                                                        Page 16
Wiener’s attack

    Recall:    e d = 1 (mod (N) )
                         k Z : e d = k (N) + 1
                       e      k        1
                          -
                      (N)     d      d (N)

    (N) = N-p-q+1      |N- (N)|     p+q   3 N
                     e - k          1
d     N0.25/3        N   d         2d2

Continued fraction expansion of e/N gives k/d.

e d = 1 (mod k)       gcd(d,k)=1
                                                 Page 17
RSA With Low public exponent

   To speed up RSA encryption (and sig. verify)
    use a small e.       C = Me (mod N)

   Minimal value: e=3     ( gcd(e, (N) ) = 1)
   Recommended value: e=65537=216+1
       Encryption: 17 mod. multiplies.

   Several weak attacks. Non known on RSA-OAEP.

   Asymmetry of RSA: fast enc. / slow dec.
    • ElGamal: approx. same time for both.
                                                   Page 18
Implementation attacks

   Attack the implementation of RSA.
   Timing attack: (Kocher 97)
       The time it takes to compute Cd (mod N)
       can expose d.

   Power attack: (Kocher 99)
       The power consumption of a smartcard while
       it is computing Cd (mod N) can expose d.

   Faults attack: (BDL 97)
        A computer error during Cd (mod N)
        can expose d.
        OpenSSL defense: check output. 5% slowdown.
                                                      Page 19
Key lengths

Security of public key system should be
 comparable to security of block cipher.
NIST:
       Cipher key-size                    Modulus size
         64 bits                            512 bits.
         80 bits                           1024 bits
        128 bits                           3072 bits.
        256 bits (AES)                    15360 bits

   High security    very large moduli.
    Not necessary with Elliptic Curve Cryptography.
                                                         Page 20

More Related Content

PDF
An Analysis of Secure Remote Password (SRP)
PDF
Solutions to online rsa factoring challenges
PPTX
RSA without Padding
PDF
Cyclic Attacks on the RSA Trapdoor Function
PDF
An Analysis of RSA Public Exponent e
PDF
Analysis of Short RSA Secret Exponent d
PDF
Analysis of Shared RSA Modulus
PDF
RSA Game using an Oracle
An Analysis of Secure Remote Password (SRP)
Solutions to online rsa factoring challenges
RSA without Padding
Cyclic Attacks on the RSA Trapdoor Function
An Analysis of RSA Public Exponent e
Analysis of Short RSA Secret Exponent d
Analysis of Shared RSA Modulus
RSA Game using an Oracle

What's hot (19)

PDF
PPT
The rsa algorithm
PDF
RSA without Integrity Checks
PDF
RSA cracking puzzle
PDF
Security Attacks on RSA
PDF
RSA Algorithm
PDF
Ntewrok secuirty cs7
PDF
On deriving the private key from a public key
PDF
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
PDF
RSA Two Person Game
PDF
Security of RSA and Integer Factorization
PDF
PKC&RSA
PPT
RSA Algorithm - Public Key Cryptography
PPT
Kleptography
PPT
PDF
Dependency Analysis of RSA Private Variables
PDF
Presentation about RSA
PPTX
同態加密
PPTX
Public Key Algorithms
The rsa algorithm
RSA without Integrity Checks
RSA cracking puzzle
Security Attacks on RSA
RSA Algorithm
Ntewrok secuirty cs7
On deriving the private key from a public key
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
RSA Two Person Game
Security of RSA and Integer Factorization
PKC&RSA
RSA Algorithm - Public Key Cryptography
Kleptography
Dependency Analysis of RSA Private Variables
Presentation about RSA
同態加密
Public Key Algorithms
Ad

Viewers also liked (18)

PDF
RSA шифрлэх арга (encryption)
PPSX
Cryptography
PDF
Криптологийн тухай ойлголт - Cryptology
DOCX
It101 lab11 use case
PDF
Erdenm shinjilgeenii hural
PDF
Computer olimpiad
DOCX
Bie daalt 2 sedev
PDF
U.IT101 Lab1
PDF
Lab6 db
DOC
Bie daaltiin ajil 2
DOCX
Laboratory 10
DOCX
лабораторийн ажил 1 дөлгөөн тайвнаа
DOCX
Laboratory 9
DOCX
U.IT101 Lab8
DOC
U.IT101 Lab3
DOCX
Laboratory 2
DOCX
It101 lab 5
DOCX
Lab7
RSA шифрлэх арга (encryption)
Cryptography
Криптологийн тухай ойлголт - Cryptology
It101 lab11 use case
Erdenm shinjilgeenii hural
Computer olimpiad
Bie daalt 2 sedev
U.IT101 Lab1
Lab6 db
Bie daaltiin ajil 2
Laboratory 10
лабораторийн ажил 1 дөлгөөн тайвнаа
Laboratory 9
U.IT101 Lab8
U.IT101 Lab3
Laboratory 2
It101 lab 5
Lab7
Ad

Similar to RSA криптосистем (20)

PPT
rsa.ppt
PPT
PDF
Public-Key Cryptography.pdfWrite the result of the following operation with t...
PPT
ch09_rsa_nemo.ppt
PPT
Rsa diffi-network security-itt
PPTX
Ch9_Cryptokkkllllllllllllllllllllk6e.pptx
PPT
Security.ppt
PPT
Unit --3.ppt
PDF
CNIT 141: 10. RSA
PPT
ch09-Critt.Asimettrica.notes has good info in security
PPTX
3 pkc+rsa
PDF
10 RSA
PPT
New ppt.ppt
PPTX
IOT_DEPARTMENT_CST_433_PSI__RSA_unit2.pptx
PDF
international security system data threats
PDF
PRINCIPLES OF INFORMATION SYSTEM SECURITY
PPT
PPTX
Security
PPTX
Module-2 Public-Key Cryptography and RSA.pptx
rsa.ppt
Public-Key Cryptography.pdfWrite the result of the following operation with t...
ch09_rsa_nemo.ppt
Rsa diffi-network security-itt
Ch9_Cryptokkkllllllllllllllllllllk6e.pptx
Security.ppt
Unit --3.ppt
CNIT 141: 10. RSA
ch09-Critt.Asimettrica.notes has good info in security
3 pkc+rsa
10 RSA
New ppt.ppt
IOT_DEPARTMENT_CST_433_PSI__RSA_unit2.pptx
international security system data threats
PRINCIPLES OF INFORMATION SYSTEM SECURITY
Security
Module-2 Public-Key Cryptography and RSA.pptx

Recently uploaded (20)

PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
1_English_Language_Set_2.pdf probationary
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Classroom Observation Tools for Teachers
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
Digestion and Absorption of Carbohydrates, Proteina and Fats
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
advance database management system book.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Trump Administration's workforce development strategy
PDF
Hazard Identification & Risk Assessment .pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
202450812 BayCHI UCSC-SV 20250812 v17.pptx
1_English_Language_Set_2.pdf probationary
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
LDMMIA Reiki Yoga Finals Review Spring Summer
Classroom Observation Tools for Teachers
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Weekly quiz Compilation Jan -July 25.pdf
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Digestion and Absorption of Carbohydrates, Proteina and Fats
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Orientation - ARALprogram of Deped to the Parents.pptx
advance database management system book.pdf
Computing-Curriculum for Schools in Ghana
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Final Presentation General Medicine 03-08-2024.pptx
Trump Administration's workforce development strategy
Hazard Identification & Risk Assessment .pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc

RSA криптосистем

  • 1. The RSA Cryptosystem Dan Boneh Stanford University
  • 2. The RSA cryptosystem  First published: • Scientific American, Aug. 1977. (after some censorship entanglements)  Currently the “work horse” of Internet security: • Most Public Key Infrastructure (PKI) products. • SSL/TLS: Certificates and key-exchange. • Secure e-mail: PGP, Outlook, … Page 2
  • 3. The RSA trapdoor 1-to-1 function  Parameters: N=pq. N 1024 bits. p,q 512 bits. e – encryption exponent. gcd(e, (N) ) = 1 .  1-to-1 function: RSA(M) = Me (mod N) where M ZN*  Trapdoor: d – decryption exponent. Where e d = 1 (mod (N) ) d (N)+1  Inversion: RSA(M) = Med = Mk = M (mod N)  (n,e,t, )-RSA Assumption: For any t-time alg. A: Pr[ A(N,e,x) = x ]< 1/e p,q R n-bit primes, (N) : N pq, x R ZN* Page 3
  • 4. Textbook RSA is insecure  Textbook RSA encryption: • public key: (N,e) Encrypt: C = Me (mod N) • private key: d Decrypt: Cd = M (mod N) (M Z N* )  Completely insecure cryptosystem: • Does not satisfy basic definitions of security. • Many attacks exist.  The RSA trapdoor permutation is not a cryptosystem ! Page 4
  • 5. A simple attack on textbook RSA Rando CLIENT HELLO m session- Web SERVER HELLO (e,N) Web d key K Browser Server C=RSA(K)  Session-key K is 64 bits. View K {0,…,264} Eavesdropper sees: C = Ke (mod N) .  Suppose K = K1 K2 where K1, K2 < 234 . (prob. 20%) Then: C/K1e = K2e (mod N)  Build table: C/1e, C/2e, C/3e, …, C/234e . time: 234 For K2 = 0,…, 234 test if K2e is in table. time: 234 34  Attack time: 240 << 264 Page 5
  • 6. Common RSA encryption  Never use textbook RSA.  RSA in practice: Preprocessing RSA ciphertext msg  Main question: • How should the preprocessing be done? • Can we argue about security of resulting system? Page 6
  • 7. PKCS1 V1.5  PKCS1 mode 2: (encryption) 16 bits 02 random pad FF msg 1024 bits  Resulting value is RSA encrypted.  Widely deployed in web servers and browsers.  No security analysis !! Page 7
  • 8. Attack on PKCS1  Bleichenbacher 98. Chosen-ciphertext attack.  PKCS1 used in SSL: C= ciphertext d C Is this PKCS1? Web Attacker Yes: continue Server 02 No: error attacker can test if 16 MSBs of plaintext = ’02’.  Attack: to decrypt a given ciphertext C do: e • Pick r ZN. Compute C’ = C = (r PKCS1(M)) . re • Send C’ to web server and use response. Page 8
  • 9. Chosen ciphertext security (CCS)  No efficient attacker can win the following game: (with non-negligible advantage) M0 , M1 C=E(Mb) b Decryption Challenger R Attacker oracle Challenge C b’ Attacker wins if b=b’ Page 9
  • 10. PKCS1 V2.0 - OAEP  New preprocessing function: OAEP (BR94). M 01 00..0 rand. + H Check pad on decryption. Reject CT if invalid. G + Plaintext to encrypt with RSA {0,1}n-1  Thm: RSA is trap-door permutation OAEP is CCS when H,G are “random oracles”.  In practice: use SHA-1 or MD5 for H and G. Page 10
  • 11. OAEP Improvements  OAEP+: (Shoup’01) M W(M,R) R trap-door permutation F + H F-OAEP+ is CCS when H,G,W are “random oracles”. G +  SAEP+: (B’01) M W(M,R) R RSA trap-door perm RSA-SAEP+ is CCS when + H H,W are “random oracle”. Page 11
  • 12. Subtleties in implementing OAEP [M ’00] OAEP-decrypt(C) { error = 0; if ( RSA-1(C) > 2n-1 ) { error =1; goto exit; } if ( pad(OAEP-1(RSA-1(C))) != “01000” ) } { error = 1; goto exit; }  Problem: timing information leaks type of error. Attacker can decrypt any ciphertext C.  Lesson: Don’t implement RSA-OAEP yourself … Page 12
  • 13. Part II: Is RSA a One-Way Function?
  • 14. Is RSA a one-way permutation?  To invert the RSA one-way function (without d) attacker must compute: M from C = Me (mod N).  How hard is computing e’th roots modulo N ??  Best known algorithm: • Step 1: factor N. (hard) • Step 2: Find e’th roots modulo p and q. (easy) Page 14
  • 15. Shortcuts?  Must one factor N in order to compute e’th roots? Exists shortcut for breaking RSA without factoring?  To prove no shortcut exists show a reduction: • Efficient algorithm for e’th roots mod N efficient algorithm for factoring N. • Oldest problem in public key cryptography.  Evidence no reduction exists: (BV’98) • “Algebraic” reduction factoring is easy. • Unlike Diffie-Hellman (Maurer’94). Page 15
  • 16. Improving RSA’s performance  To speed up RSA decryption use small private key d. Cd = M (mod N) • Wiener87: if d < N0.25 then RSA is insecure. • BD’98: if d < N0.292 then RSA is insecure (open: d < N0.5 ) • Insecure: priv. key d can be found from (N,e). • Small d should never be used. Page 16
  • 17. Wiener’s attack  Recall: e d = 1 (mod (N) ) k Z : e d = k (N) + 1 e k 1 - (N) d d (N) (N) = N-p-q+1 |N- (N)| p+q 3 N e - k 1 d N0.25/3 N d 2d2 Continued fraction expansion of e/N gives k/d. e d = 1 (mod k) gcd(d,k)=1 Page 17
  • 18. RSA With Low public exponent  To speed up RSA encryption (and sig. verify) use a small e. C = Me (mod N)  Minimal value: e=3 ( gcd(e, (N) ) = 1)  Recommended value: e=65537=216+1 Encryption: 17 mod. multiplies.  Several weak attacks. Non known on RSA-OAEP.  Asymmetry of RSA: fast enc. / slow dec. • ElGamal: approx. same time for both. Page 18
  • 19. Implementation attacks  Attack the implementation of RSA.  Timing attack: (Kocher 97) The time it takes to compute Cd (mod N) can expose d.  Power attack: (Kocher 99) The power consumption of a smartcard while it is computing Cd (mod N) can expose d.  Faults attack: (BDL 97) A computer error during Cd (mod N) can expose d. OpenSSL defense: check output. 5% slowdown. Page 19
  • 20. Key lengths Security of public key system should be comparable to security of block cipher. NIST: Cipher key-size Modulus size 64 bits 512 bits. 80 bits 1024 bits 128 bits 3072 bits. 256 bits (AES) 15360 bits  High security very large moduli. Not necessary with Elliptic Curve Cryptography. Page 20