Public Key Cipher (RSA-1)
Public Key Cipher (RSA-1)
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
Encrypted_Message)
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
Private
Key
Public
Key
INFO 2411
KPU
Four Keys
– Each side has a public and a private key
– Each sends public key to other
unsecurely
– Encrypt with other party’s public key
– Decrypt with own private key
INFO 2411
KPU
A B’s B’s
B
Pub Key Priv Key
A’s A’s
Priv Key Pub Key
INFO 2411
KPU
E Network D
Secret Key
Alice
Bob
INFO 2411
KPU
INFO 2411
KPU
Bob: (e, n)
public key:
e &n
Plain Text Cipher Text Cipher Text Plain Text
c= m=
Network
me mod n cd mod n
RSA (1)
Bob:
– chooses 2 large primes (each at least 100
digits): p, q
multiplies p and q: n = p*q
– finds out two numbers e & d such that
e * d = 1 (mod (p-1)(q-1))
INFO 2411
KPU
RSA (1)
Bob:
– public key (published in the phone book)
2 numbers: (e, n)
encryption algorithm: modular
exponentiation
– secret key: d
INFO 2411
KPU
RSA (2)
Alice has a message m to be sent to
Bob:
– finds out Bob’s public encryption key
(e, n)
– calculates
c = me (mod n)
– sends the ciphertext c to Bob
INFO 2411
KPU
RSA (3)
Bob:
– receives the ciphertext c from Alice
– uses his matching secret decryption key
d to calculate
m = cd (mod n)
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
Use of private
and public key
ciphers in Practice
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
INFO 2411
KPU
Single Single
Session Session
Key Key
A B
INFO 2411
KPU
encrypted encrypted
DES key
DES key DES key DES key
E Network D
Secret Key
Alice
Bob
INFO 2411
KPU
Network D
E
or Storage
Alice Bob
INFO 2411
KPU
0110100101110100
26996
INFO 2411
KPU
26995
0110100101110011
is
INFO 2411
KPU
RSA Example
INFO 2411
KPU
Message
Now we need to divide the message into
blocks of bits
– RULE: find the highest power of 2 less than n
– In our case, n = 2173 and 211 = 2048 but 212 =
4096
– So, divide the plaintext into blocks of 11 bits
Encrypt the message “JABBERWOCKY”
INFO 2411
KPU
Blocks
The 11 bit blocks and their decimal equivalent
are: binary decimal
01011010010 722
00001010000 80
10010000100 1156
10001010101 1109
00100101011 299
10100111101 1341
00001101001 105
01101011001 857
Ciphertext
The ciphertext is generated by:
722207 = 1794 = c1 mod 2173
80207 = 1963 = c2 mod 2173
1156207 = 1150 = c3 mod 2173
1109207 = 702 = c4 mod 2173
299207 = 145 = c5 mod 2173
1342207 = 593 = c6 mod 2173
105207 = 2013 = c7 mod 2173
857207 = 1861 = c8 mod 2173
Decipher
RSA Performance
INFO 2411