# Public Key Cryptography - Computer Science

Public Key
Cryptography

Bryan Pearsaul

Outline

What is Cryptology?

Symmetric Ciphers

Asymmetric Ciphers

Diffie
-
Hellman

Moral Issues

Outline

Summary

References

What is Cryptology?

The science of keeping data secure

Two transformation algorithms:

Enciphering and Deciphering

Symmetric ciphers

Asymmetric ciphers

Symmetric Ciphers

Also known as private key

Both parties must agree on the key

D_K(E_K(P)) = P

Not very computationally intensive

Key must be securely sent to both parties

Symmetric Cipher Example

k

= 4

Enciphering

E

E_K(X)

Deciphering

D

D_K(E_K(X)) = X

X

K

Turn plaintext SECRET into
ciphertext

S+4=W, E+4=I, C+4=G, R+4=V, E+4=I,
T+4=X

Symmetric Cipher Example

Much more elaborate transformations

are available

Some that are so complicated that

even if the transformation was

public a key would still be needed

Still require a distributed key

Asymmetric cipher

Also known as public key

Enciphering

E

E_K(X)

Deciphering

D

D_K’(E_K(X)) = X

X

K’

K

Two keys: public
k
, private
k’

Private key not required for both

parties

More computationally intensive

Diffie
-
Hellman

One of the first public key
cryptographic systems

Developed by Martin Hellman, Ralph
Merkle, and Whitfield Diffie at
Stanford University in 1976

Diffie
-
Hellman

Based on a special case of the

subset
-
sum, or knapsack, problem

Subset
-
sum Problem

5

8

4

11

6

20

Diffie
-
Hellman Example

Block cipher

Block size of 7 bits. Possible 2
7

combinations

Private key (
a’
1
,
a’
2
, … ,
a’
n
) of 7 integers: (1, 2, 5, 11, 32, 87, 141)

Chose two special integers,
w

and
m
,

such that
w

and
m

are relatively prime,

meaning gcd(
w
,
m
) = 1:
w

= 901,
m

= 1234

Public key (
a
1
,
a
2
, … ,
a
n
)

of 7 integers using the equation:
a
i

=
w
*

a’
i

mod
m
:

(901, 568, 803, 39, 450, 645, 1173)

Partition SECRET into 7 bit blocks each block consisting of x
n

bits (
x
1
,
x
2
, …,
x
n
)

S

1010011

E

1000101

C

1000011

R

1010010

E

1000101

T

1010100

B
x

=

x
i
a
i

i=1

n

S = 1 X (901) + 0 X (568) + 1 X (803) + 0 X (39) + 0 X (450) + 1 X (645) + 1 X (1173)

S = 3522

Diffie
-
Hellman Example

Encrypted blocks B
x

received. Special version of subset
-
sum problem

Which subset of (
a’
1
,
a’
2
, … ,
a’
n
) sums to
B’
x
where
B’
x

=
B
x

*

w
-
1

mod
m

w
-
1

is the modular inverse of
w

for
m
,
w

*

w
-
1

mod
m

= 1

B’
x

= 3522 X (901)
-
1

mod 1234

B’
x

= 3522 X 1171 mod 1234

B’
x

= 234

1.
sum

0

2. for
i = n
step
-
1 until 1 do

if
a
i

+
sum

<=
B’
x

then
sum

sum

+
a
i
;

subset(i)

1

else subset(i)

0

3. if sum =
B’
x

then exit with subset

else exit with “failure”

Private key (1, 2, 5, 11, 32, 87, 141),
B’
x

= 234, find subset (1, 0, 1, 0, 0, 1, 1) = S

Diffie
-
Hellman

An algorithm that solves the
particular problem on which a
cryptographic system is based.

An algorithm which solves NP
-
complete problems quickly

Two possible points of vulnerability

RSA

Factorization so far is unsolvable in
polynomial
-
time

Based on the difficulty of factoring
large numbers

Developed by Ron Rivest, Adi
Shamir, and Leonard Adleman at
MIT in 1977.

RSA Example

Find two large prime integers,
p
and
q
, and form product
n

=
pq

Find a random integer,
e
, that is relatively prime to Ф(n) = (
p
-
1)(
q
-
1)

p

and
q

are kept private, (
n
,
e
) are the public key

Message is partitioned into blocks,
b
, such that
b

<
n

Each block is encrypted using the equation:
c

=
b
e

mod
n

For the private key, calculate integer
d

which is the modular inverse of
e

for Ф(n), or
e
*
d

mod Ф(n) = 1

Once
d

is calculated it becomes your private key and all records of

p

and
q

should be destroyed

Each encrypted block,
c
, is decrypted using the equation:
b

=
c
d

mod
n

p = 61, q = 53, n = 3233, Ф(n) = 3120, e = 17, d = 2753

encrypt(123) = 123
17

mod 3233 = 855

decrypt(855) = 855
2753

mod 3233 = 123

RSA

Factorization cannot be done in
polynomial
-
time

Factoring is required to break the
system

Security of RSA relies on two
assumptions

Moral Issues

Information Theft

Who does the data belong to?

Privacy

Summary

Diffie
-
Hellman and RSA

Symmetric and Asymmetric ciphers

Pros and Cons

Cryptology

Moral Issues

References

A. Shamir, “A Polynomial
-
Time Algorithm for Breaking the Basic Merkle
-
Hellman
Cryptosystem", A
dvances in Cryptology
-

CRYPTO '82 Proceedings
, pp. 279
-
288,
Plenum Press, 1983.
IEEE Transactions on Information Theory
, Vol. IT
-
30, pp. 699
-
704, 1984.

A.K. Dewdney,
The New Turning Omnibus
, pp. 250
-
257, Henry Holt and Company,
2001.

RSA Cryptosystem, http://primes.utm.edu/glossary/page.php?sort=RSA.

Cryptology FAQ, http://www.faqs.org/faqs/cryptography
-
faq/part06/.

The Extended Euclidian Algorithm,
http://www.grc.nasa.gov/WWW/price000/pfc/htc/zz_xeuclidalg.html.