CS 342 - 2/25/16
Upcoming Items:
Tuesday 3/1 - Test Cases for Project 2
Tuesday 3/8 - Design Document for Project 3
Thursday 3/10 - Midterm
Tuesday 3/15 - Project 3
Create a Key Pair (PubKey, PriKey)
The PubKey gets shared; PriKey is kept private.
When a message is being sent to me.
Sender encypts the message with the PubKey
The Encrypted message is now sent to receiver.
Receiver "decrypts" the message with the PriKey.
To create a PriKey, PubKey pair
we first need
- 2 prime number: p, q
- n = p * q
- m = (p-1)(q-1)
- now find a value e which is co-prime to m
co-prime ==> GCD (e, m) is 1
- now find d, such that de % m = 1
- we now have a set of numbers:
p, q, n, m, e, d
The Public key consists of the pair: n, e
The Private key consists of the pair: n, d
Assume the message we are sending is Y
The calculation to encrypt: Z = Y^e % n
Z is the encrypted message
To decrypt we use the same formula but substitute
d for e
z^d % n ==> Y
Typically the overall process for restricted delivery occurs
as follows.
1. Person 1 creates a public-private key set.
2. Person 1 sends the public key to Person 2 but
keeps the private key
3. Person 2 creates an ASCII text message.
4. Person 2 blocks the message into a blocked file
with block size X
5. Person 2 uses Person 1’s public key to encrypt the blocked file.
6. Person 2 send the encrypted blocked file to Person 1
7. Person 1 decrypts the encrypted blocked file using Person 1’s
private key to (hopefully) get the
original blocked file Person 2 created in step 4.
(Since Person 1 should be the only person with this private key,
Person 1 should be the only person who can decrypt the message.)
8. Person 1 unblocks the file created in step 7 to
(hopefully) get the original ASCII text message