General - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

General

Description:

Totient Function. x, m relative prime: no other common factor than 1. Totient function (n): number of integers less than n relatively prime to n ... – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 19
Provided by: fengmi5
Category:

less

Transcript and Presenter's Notes

Title: General


1
Public Key Algorithms
CS 6262 Spring 03
2
Modular Arithmetic
  • Public key algorithms are based on modular
    arithmetic.
  • Modular addition.
  • Modular multiplication.
  • Modular exponentiation.

3
Modular Addition
  • Addition modulo (mod) K
  • Poor cipher with (dkdm) mod K, e.g., if K10 and
    dk is the key.
  • Additive inverse addition mod K yields 0.
  • Decrypt by adding inverse.

4
Modular Multiplication
  • Multiplication modulo K
  • Multiplicative inverse multiplication mod K
    yields 1
  • Only some numbers have inverse
  • Use Euclids algorithm to find inverse
  • Given x, n, it finds y such that x?y mod n 1
  • All number relatively prime to n will have mod n
    multiplicative inverse

5
Totient Function
  • x, m relative prime no other common factor than
    1
  • Totient function ø(n) number of integers less
    than n relatively prime to n
  • if n is prime, ø(n)n-1
  • if np?q, and p, q are primes, ø(n)(p-1)(q-1)

6
Modular Exponentiation
  • xy mod n xy mod ø(n) mod n
  • if y 1 mod ø(n) then xy mod n x mod n

7
RSA (Rivest, Shamir, Adleman)
  • The most popular one.
  • Support both public key encryption and digital
    signature.
  • Assumption/theoretical basis
  • Factoring a big number is hard.
  • Variable key length (usually 512 bits).
  • Variable plaintext block size.
  • Plaintext must be smaller than the key.
  • Ciphertext block size is the same as the key
    length.

8
What Is RSA?
  • To generate key pair
  • Pick large primes (gt 256 bits each) p and q
  • Let n pq, keep your p and q to yourself!
  • For public key, choose e that is relatively
    prime to ø(n) (p-1)(q-1), let pub lte,ngt
  • For private key, find d that is the
    multiplicative inverse of e mod ø(n), i.e., ed
    1 mod ø(n), let priv ltd,ngt

9
How Does RSA Work?
  • Given pub lte, ngt and priv ltd, ngt
  • encryption c me mod n, m lt n
  • decryption m cd mod n
  • signature s md mod n, m lt n
  • verification m se mod n

10
Why Does RSA Work?
  • Given pub lte, ngt and priv ltd, ngt
  • n pq, ø(n) (p-1)(q-1)
  • ed 1 mod ø(n)
  • xe?d x mod n
  • encryption c me mod n
  • decryption m cd mod n me?d mod n m mod n
    m (since m lt n)
  • digital signature (similar)

11
Why Is RSA Secure?
  • Factoring 512-bit number is very hard!
  • But if you can factor big number n then given
    public key lte,ngt, you can find d, hence the
    private key by
  • Knowing factors p, q, such that, n pq
  • Then ø(n) (p-1)(q-1)
  • Then d such that ed 1 mod ø(n)

12
Diffie-Hellman Key Exchange
  • Shared key, public communication
  • No authentication of partners
  • Whats involved?
  • P is a prime (about 512 bits), and g lt p
  • P and g are publicly known

13
Diffie-Hellman Key Exchange
  • Procedure
  • Alice Bob
  • pick secret Sa randomly pick secret Sb
    randomly
  • compute TAgSa mod p compute TBgSb mod p
  • send TA to Bob send TB to Alice
  • compute TBSa mod p compute TASb mod p
  • Alice and Bob reached the same secret gSaSb mod
    p, which is then used as the shared key.

14
DH Security - Discrete Logarithm Is Hard
  • T gs mod p
  • Conjecture given T, g, p, it is extremely hard
    to compute the value of s (discrete logarithm)

15
Diffie-Hellman Scheme
  • Security factors
  • Discrete logarithm very difficult.
  • Shared key (the secret) itself never transmitted.
  • Disadvantages
  • Expensive exponential operation
  • DoS possible.
  • The scheme itself cannot be used to encrypt
    anything it is for secret key establishment.
  • No authentication, so you can not sign anything

16
Bucket Brigade Attack...Man In The Middle
  • Alice Trudy Bob
  • gSa123 gSx 654 gSb 255
  • 123 --gt 654 --gt
  • lt--654 lt--255
  • 654Sa123Sx 255Sx654Sb
  • Trudy plays Bob to Alice and Alice to Bob

17
Diffie-Hellman in Phone Book Mode
  • DH was subject to active man-in-the-middle attack
    because their public key-component was
    intercepted and substituted
  • Phone book mode allows everyone to generate the
    public key-component in advance and publish them
    through other reliable means, e.g. ltTBgt for bob
  • All communicating parties agree on their common
    ltg, pgt

18
Encryption With Diffie-Hellman
  • Everyone computes and publishes ltp, g, Tgt
  • TgS mod p
  • Alice communicates with Bob
  • Alice
  • Picks a random secret Sa
  • Computes gbSa mod pb
  • Use Kab TbSa mod pb to encrypt message
  • Send encrypted message along with gbSa mod pb
  • Bob
  • (gbSa)Sb mod pb (gbSb)Sa mod pb TbSa mod pb
    Kab
  • Use Kab to decrypt
Write a Comment
User Comments (0)
About PowerShow.com