Sei sulla pagina 1di 16

Starter Activity

1
2

Public Key Cryptography
& RSA Algorithm

Aim & Objectives
Private-key Cryptography

Public-Key Cryptography

RSA Algorithm

RSA with example work

Activity



3
Private-Key Cryptography
4
5
Public key Cryptography
Also known as asymmetric cryptography
A pair of keys (Public, Private)
(Can think of this as one long key in two parts)
One used for encryption, the other for decryption
One publicly accessible, the other private to one person
Algorithms / Systems
RSA (Rivest, Shamir, Adelman)
DSA (Digital Signature Algorithm)
PGP, OpenPGP, GPG (Gnus PGP)
ssh, sftp
SSL
6
Public Key Cryptography
Plaintext
Original
Plaintext
Encryption Decryption
Ciphertext
Encryption with
Receivers Public
Key
Decryption with
Receivers Private
Key
7
Public Key Cryptography
Key is some large number (string of bits)
Key has two parts, one public, one private
Public key is well-known
Trusted agents verify the public key
Private key is a secret forever
Key is arbitrarily large
Encrypt with receivers public key
Decrypt with receivers private key
8
RSA Algorithm
Rivest, Shamir & Adleman of MIT in 1977
best known & widely used public-key scheme
RSA Key Setup
Choose two large primes, p and q
Compute n = (p)(q)
Compute z = (p-1)(q-1)
Choose d such that it is relatively prime to z (no
common divisor)
Find e such that (e)(d) modulo z = 1
Public key is (e,n)
Private key is (d,n)
9
RSA Algorithm
To encrypt plaintext message m, compute
c = m
e
mod n
To decrypt ciphertext message c, compute
m = c
d
mod n
10
Work an Example
1. Choose two (not so large) primes, p and q
p = 47 and q = 71
2. n = (p)(q) = (47)(71)
= 3337 = n
3. z = (p-1)(q-1) = (46)(70)
= 3220 = z
4. Choose e (or d) such that it is relatively prime to z
(i.e., e and z share no common divisors)
e=5? 3220/5=644 no
e=23? 3220/23=140 no
e=35? 3220/35=92 no
e=79? 3220 and 79 share no divisors ... yes

11
Work an Example
5. Choose d such that (e)(d) modulo z = 1
So: 79d mod z = 1 now what?
6. Public key = (e, n) = (79, 3337)
7. Private key = (d, n) = (1019, 3337)
Compute candidate values of d
d = 1019 or 4239 or 7459 or ...
12
Work an Example
9. Decrypt: m = c
d
mod n
m = 2140
1019
mod 3337
m = 3
8. Encrypt: c = m
e
mod n
c = 3
79
mod 3337
c = 2140
13
14
RSA Algorithm
Now imagine that p and q are hundreds of
digits long!
Power of PKC based upon the difficulty of
factoring large numbers
Commercial firms provide:
choice of p and q
suitable e and d
software for large integer arithmetic
registration of keys to a particular entity
15
RSA Implementation
Java implementation of the RSA version of public
key cryptography
http://intercom.virginia.edu/crypto/crypto.html

Activity
16

Potrebbero piacerti anche