• No results found

(4)WHY PUBLIC-KEY CRYPTOGRAPHY

N/A
N/A
Protected

Academic year: 2022

Share "(4)WHY PUBLIC-KEY CRYPTOGRAPHY"

Copied!
35
0
0

Loading.... (view fulltext now)

Full text

(1)

P

UBLIC

K

EY

C

RYPTOGRAPHY

Ref: Cryptography and Network security by William Stallings

(2)

P

RIVATE

-K

EY

C

RYPTOGRAPHY

All previous cryptographic systems have been based on of substitution and permutation.

Traditional private/secret/single key cryptography uses one key shared by both sender and receiver

If this key is disclosed communications are compromised

(3)

P

UBLIC

-K

EY

C

RYPTOGRAPHY

Probably most significant advance in the 3000 year history of cryptography

Uses two keys – a public & a private key

Uses clever application of number theoretic concepts to function

Complements rather than replaces private key crypto.

(4)

W

HY

P

UBLIC

-K

EY

C

RYPTOGRAPHY

?

Developed to address two key issues:

key distribution – how to have secure communications in general without having to trust a KDC with your key

digital signatures – how to verify a message comes intact from the claimed sender

Invention by Whitfield Diffie & Martin Hellman at Stanford Uni in 1976

known earlier in classified community

(5)

P

UBLIC

-K

EY

C

RYPTOGRAPHY

Public-key/two-key/asymmetric cryptography involves the use of two keys:

a public-key, which may be known by anybody, and can be used to encrypt messages, and verify signatures

a related private-key, known only to the recipient, used to decrypt messages, and sign (create) signatures

Infeasible to determine private key from public

Asymmetric because

those who encrypt messages or verify signatures cannot decrypt messages or create signatures

(6)

P

UBLIC

-K

EY

C

RYPTOGRAPHY

(7)

S

YMMETRIC VS

P

UBLIC

-K

EY

(8)

P

UBLIC

-K

EY

C

RYPTOSYSTEMS

(9)

P

UBLIC

-K

EY

A

PPLICATIONS

It can be applied into 3 categories:

encryption/decryption (provide secrecy)

digital signatures (provide authentication)

key exchange (of session keys)

Some algorithms are suitable for all uses, others are specific to one

(10)

P

UBLIC

-K

EY

R

EQUIREMENTS

Public-Key algorithms rely on two keys where:

It is computationally easy for a party B to generate a pair (public key PUb, private key PRb).

It is computationally feasible to en/decrypt messages when the relevant (en/decrypt) key is known

It is computationally infeasible to find decryption key knowing only algorithm & encryption key

It is computationally infeasible for an adversary, knowing the public key, Pb, to determine the private key, PRb

It is computationally infeasible for an adversary, knowing the public key, Pb, and a ciphertext, C, to recover the original message, M.

The above are formidable requirements which only a few algorithms have satisfied

(11)

P

UBLIC

-K

EY

R

EQUIREMENTS

Need a trapdoor one-way function

One-way function has the following property:

Y = f(X) easy

X = f–1(Y) infeasible

A trap-door one-way function has

Y = fk(X) easy, if k and X are known

X = fk–1(Y) easy, if k and Y are known

X = fk–1(Y) infeasible, if Y known but k not known

A practical public-key scheme depends on a suitable trap- door one-way function

(12)

S

ECURITY OF

P

UBLIC

K

EY

S

CHEMES

Like private key schemes brute force exhaustive search attack is always theoretically possible

but keys used are too large (>512bits)

requires the use of very large numbers

hence is slow compared to private key schemes

(13)

RSA

Proposed by Rivest, Shamir & Adleman of MIT in 1977.

Best known & widely used public-key scheme

Uses large integers (eg. 1024 bits).

Security due to cost of factoring large

numbers.

(14)

RSA E

N

/

DECRYPTION

To encrypt a message M the sender:

obtains public key of recipient PU={e,n}

computes: C = Me mod n, where 0≤M<n

To decrypt the ciphertext C the owner:

uses their private key PR={d,n}

computes: M = Cd mod n

Note that the message M must be smaller than the modulus n (block if needed)

(15)

RSA K

EY

S

ETUP

Each user generates a public/private key pair by: selecting two large primes at random: p, q

computes their system modulus n=p.q

note ø(n)=(p-1)(q-1)

selecting at random the encryption key e

where 1<e<ø(n), gcd(e,ø(n))=1

solve following equation to find decryption key d

e.d=1 mod ø(n) and 0≤d≤n

publish their public encryption key: PU={e,n}

keep secret private decryption key: PR={d,n}

(16)

H

OW

RSA W

ORKS

In RSA have:

n=p.q

ø(n)=(p-1)(q-1)

carefully chose e & d to be inverses mod ø(n)

hence e.d=1 mod ø(n) for some k

(17)

RSA E

XAMPLE

- K

EY

S

ETUP

1.

Select primes: p=17 & q=11

2.

Calculate n = pq =17 x 11=187

3.

Calculate ø(n)=(p–1)(q-1)=16x10=160

4.

Select e: gcd(e,160)=1; choose e=7

5.

Determine d: de=1 mod 160 and d < 160 Value is d=23 since 23x7=161= 10x160+1

6.

Publish public key PU={7,187}

7.

Keep secret private key PR={23,187}

(18)

RSA E

XAMPLE

- E

N

/D

ECRYPTION

sample RSA encryption/decryption is:

given message M = 88 (note: 88<187)

encryption:

C = 887 mod 187 = 11

decryption:

M = 1123 mod 187 = 88

(19)

E

FFICIENT

E

NCRYPTION

Encryption uses exponentiation to power e

Hence if e small, this will be faster

often choose e=65537 (216-1)

also see choices of e=3 or e=17

But if e too small (eg e=3) can attack

(20)

RSA K

EY

G

ENERATION

Users of RSA must:

determine two primes at random - p, q

select either e or d and compute the other

Primes p,q must not be easily derived from n=p.q

means must be sufficiently large

Exponents e, d are inverses, so use Inverse algorithm to compute the other

(21)

S

OME

Q

UESTIONS OF

RSA

Perform encryption and decryption using the RSA algorithm

b. p = 5; q = 11, e = 3; M = 9

p = 3; q = 11, e = 7; M = 5

In a public-key system using RSA, you intercept the ciphertext C = 10 sent to a user whose public key is e = 5, n = 35. What is the plaintext M?

In the RSA public-key encryption scheme, each user has a public key, e, and a private key, d.

Suppose Bob leaks his private key. Rather than generating a new modulus, he decides to generate a new public and a new private key. Is this safe?

(22)

D

IFFIE

-H

ELLMAN

K

EY

E

XCHANGE

First public-key type scheme proposed by Diffie &

Hellman in 1976

note: now it is revealed that Williamson (UK CESG) secretly proposed the concept in 1970

It is a practical method for public exchange of a secret key

It is used in a number of commercial products

(23)

D

IFFIE

-H

ELLMAN

K

EY

E

XCHANGE

A public-key distribution scheme

cannot be used to exchange an arbitrary message

rather it can establish a common key

known only to the two participants

Value of key depends on the participants (and their private and public key information).

The Diffie-Hellman algorithm depends for its

effectiveness on the difficulty of computing

discrete logarithms.

(24)

D

IFFIE

-H

ELLMAN

K

EY

E

XCHANGE

(25)

D

ISCRETE

L

OGARITHMS

A primitive root of a prime number p is one whose powers modulo p generate all the integers from 1 to p - 1.

If a is a primitive root of the prime number p, then the numbers

a mod p, a2 mod p,,,, ap-1 mod p

are distinct and consist of the integers from 1 through p - 1 in some permutation.

For any integer b and a primitive root a of prime number p, we can find a unique exponent i such that

The exponent i is referred to as the discrete logarithm of b for the base a, mod p.

We express this value as dloga,p(b)

(26)
(27)

D

IFFIE

-H

ELLMAN

S

ETUP

All users agree on global parameters:

large prime integer q

a being a primitive root mod q

Each user (eg. A) generates their key

chooses a secret key (number): xA < q

compute their public key: yA = axA mod q

Each user makes public that key yA

(28)

D

IFFIE

-H

ELLMAN

K

EY

E

XCHANGE

shared session key for users A & B is K

AB

:

KAB = axA.xB mod q

= yAxB mod q (which B can compute)

= yBxA mod q (which A can compute)

K

AB

is used as session key in private-key encryption scheme between Alice and Bob

if Alice and Bob subsequently

communicate, they will have the same key as before, unless they choose new public-keys

attacker needs an x, must solve discrete

log

(29)

D

IFFIE

-H

ELLMAN

E

XAMPLE

users Alice & Bob who wish to swap keys:

agree on prime q=353 and a=3

select random secret keys:

A chooses xA=97, B chooses xB=233

compute respective public keys:

yA=397 mod 353 = 40 (Alice)

yB=3233 mod 353 = 248 (Bob)

compute shared session key as:

KAB= yBxA mod 353 = 24897 = 160 (Alice)

KAB= yAxB mod 353 = 40233 = 160 (Bob)

(30)

K

EY

E

XCHANGE

P

ROTOCOLS

Users could create random private/public D-H keys each time they communicate

Users could create a known private/public D-H key and publish in a directory, then consulted and used to securely communicate with them

Both of these are vulnerable to a meet-in-the- Middle Attack

Authentication of the keys is needed

(31)

M

AN

-

IN

-

THE

-M

IDDLE

A

TTACK

(32)

S

OME

Q

UESTIONS OF

D

IFFIE

-H

ELLMAN

1. Consider a Diffie-Hellman scheme with a common prime q = 11 and a primitive root a = 2.

a. Show that 2 is a primitive root of 11.

b. If user A has public key YA = 9, what is A’s private key XA? c. If user B has public key YB = 3, what is the secret key K shared with A?

2. In the Diffie-Hellman protocol, each participant selects a secret number x and sends the other participant ax mod q for some public number a. What would happen if the participants sent each other xa for some public number a instead? Give at least one method Alice and Bob could use to agree on a key.

Can Eve break your system without finding the secret numbers? Can Eve find the secret numbers?

(33)

E

L

G

AMAL

C

RYPTOGRAPHY

Public-key cryptosystem related to D-H

Provides security because of difficulty in computing discrete logarithms, as in D-H

Each user (eg. A) generates their key

chooses a secret key (number): 1 < xA < q-1

compute their public key: yA = axA mod q

(34)

E

L

G

AMAL

M

ESSAGE

E

XCHANGE

Bob encrypt a message to send to A with following computation:

represent message M in range 0 <= M <= q-1

longer messages must be sent as blocks

chose random integer k with 1 <= k <= q-1

compute one-time key K = yAk mod q

encrypt M as a pair of integers (C1,C2) where

C1 = ak mod q ; C2 = KM mod q

A then recovers message by

recovering key K as K = C1xA mod q

computing M as M = C2 K-1 mod q

A unique k must be used each time

otherwise result is insecure

(35)

E

L

G

AMAL

E

XAMPLE

Use q=19 and a=10

Alice computes her key:

A chooses xA=5 & computes yA=105 mod 19 = 3

Bob send message m=17 as (11,5) by

chosing random k=6

computing K = yAk mod q = 36 mod 19 = 7

computing C1 = ak mod q = 106 mod 19 = 11;

C2 = KM mod q = 7.17 mod 19 = 5

Alice recovers original message by computing:

recover K = C1xA mod q = 115 mod 19 = 7

compute inverse K-1 = 7-1 = 11

recover M = C2 K-1 mod q = 5.11 mod 19 = 17

References

Related documents

Addressing sovereign debt distress is a long-standing challenge that requires a comprehensive three-pronged approach by key public and private actors: Suspend debt service payments to

 Rather than just shifting the alphabet, each plaintext letter maps to a different random ciphertext letter..  It allows arbitrary substitution, where the translation alphabet can

Previously the proposed blind signature follow the foot steps of public key cryptography(PKC) but conventional public key cryptography uses an affirmation of a relationship

Static group signatures contains four polynomial time algorithms[27] namely key generation in which the system generates the public key of the group, alongwith

The Public Key Infrastructure(PKI) provides the standards and policies which can be applied to sensitive data for signing and encrypting with the help of public key, private key

Definition 2.2.1.[4] A Block Cipher is a cryptosystem that separates the plaintext message into strings, called blocks, of fixed length k ∈ N, called the blocklength, and enciphers

Static group signatures consist of four polynomial time algorithm[27] namely key generation where system generates group public key with the secret key generation for signing

An odd composite number that passes the strong pseudo prime test to base is called a strong pseudo prime to base [or, ].. Simple