NET 311Information Security
Download
Report
Transcript NET 311Information Security
1
NET 311
INFORMATION SECURITY
Networks and
Communication
Department
Lecture 4: Asymmetric Ciphers
1
lecture contents:
o
o
o
17-Jul-15
Public-Key Cryptography
Why Public-Key Cryptography?
RSA Cryptography
Networks and Communication Department
Private-Key Cryptography
3
traditional private/secret/single key cryptography
uses one key
shared by both sender and receiver
if this key is disclosed communications are
compromised
also is symmetric, parties are equal
hence does not protect sender from receiver forging a
message & claiming is sent by sender
17-Jul-15
Networks and Communication Department
Public-Key Cryptography
4
probably most significant advance in the 3000 year
history of cryptography
uses two keys – a public & a private key
asymmetric since parties are not equal
uses clever application of number theoretic concepts
to function
17-Jul-15
Networks and Communication Department
Why Public-Key Cryptography?
5
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
17-Jul-15
Networks and Communication Department
Public-Key Cryptography
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
Is asymmetric because
those who encrypt messages or verify signatures
cannot decrypt messages or create signatures
Public-Key Cryptography
Asymmetric-Key Cryptography
Asymmetric-key (public key cryptography) uses two keys:
one private and one public.
There are two algorithms:
RSA
ELGAMAL
Public-Key Applications
can classify uses 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
Modular arithmetic
This example is
modulo 7
The numbers allowed
are 0 to 6
After 6, numbers
“wrap around”
7 (mod 7) = 0
3+3 (mod 7)= 6
4+4 (mod 7)= 1
0
6
1
5
2
4
3
RSA
The most common public key algorithm is RSA,
named for its inventors Rivest, Shamir, and Adelman.
It uses two numbers:
public key
d private
e
The two keys, e and d, have a special relationship to
each other.
RSA
RSA – selecting keys
Bob uses the following steps to select the private and
public keys:
Bob
chooses two very large prime numbers p and q
Bob multiplies p and q to find n n=p x q
Bob calculates another number ф = (p -1) X (q -1)
Bob chooses a random encryption number e,
where 1< e< ф and gcd(e, ф)=1
He then calculates d so that d X e mod ф = 1
Bob announces e and n to the public; he keeps ф and d
secret.
RSA – Encryption and Decryption
Encryption
Decryption
Restriction
P < n , if not, the plaintext needs to be divided into
blocks to make P less than n.
RSA Exercise
Encrypt the following message “NO” By Using RSA
algorithm.
Assume that p=17, q =11, and e= 7
Hint, each character will be encoded according to this
algorithm (A - Z) (00 – 25)
Find d , then encrypt each character individually .
The solution
Step1: calculate n, where n= p x q
= 17 x 11 = 187
Step2: calculate ɸ where ɸ = (p-1) x (q-1)
= 16 X 10 =160
Step3: calculate d, where e is given
e . d mod ɸ=1
7d mod 160 =1 d=23
This
is because 23 X 7 = 161 = ( 1 X 160) + 1
The solution
Step5: encode the plaintext.
P=“NO”= 13 14
Step6: C= pe mod n
C(N)= (13 ) 7 mod 187 = 106
C(O)=(14) 7 mod 187= 108
Step7: P= Cd mod n
P(106)= (106) 23 mod 187 =13
P(108)= (108) 23 mod 187 =14
Example 2
18
Using e=13 ,d=37, n=77 in the RSA algorithm
encrypt the message "IF" using the value of 00 to
25 for letters A to Z, do the encryption character by
character.
17-Jul-15
Networks and Communication Department
Example 3
19
Using e=7 ,d=23, n=187 in the RSA algorithm encrypt
the message M = 88.
C= 88 7
7
4
2
88 mod 187 = [(88 mod 187) × (88 mod 187)
× (881 mod 187)] mod 187
881 mod 187 = 88
882 mod 187 = 7744 mod 187 = 77
884 mod 187 = 59,969,536 mod 187 = 132
7
88 mod 187 = (88 × 77 × 132) mod 187 =
894,432 mod 187 = 11
17-Jul-15
Networks and Communication Department
RSA- Application
RSA is useful for short messages but not for long
messages.
RSA is used in digital signature , and authentication
algorithms.
Diffie-Hellman Procedure
Step 1: Alice chooses a large random number a and calculates
R1 = ga mod p
Step 2: Bob chooses another large random number b and
calculates R2 = gb mod p
Step 3: Alice sends R1 to Bob
Step 4: Bob sends R2 to Alice
Step 5: Alice calculates K = (R2) a mod p
Step 6: Bob also calculates K = (R1) b mod p
Diffie-Hellman Example
By giving g and p the following values
g = 7 and p = 23, calculate the key.
The steps are as follows:
1.
Alice chooses a = 3 and calculates R1 = 73 mod 23 = 21.
2. Bob chooses b = 6 and calculates R2 = 76 mod 23 = 4.
3. Alice sends the number 21 to Bob.
4. Bob sends the number 4 to Alice.
5. Alice calculates the symmetric key K = 43 mod 23 = 18.
6. Bob calculates the symmetric key K = 216 mod 23 = 18.
Diffie-Hellman Example
The value of K is the same for both Alice and Bob;
gab mod p = 718 mod 23 = 18.
Therefore, we can say that symmetric (shared) key
in the Diffie-Hellman protocol is K = gab mod p.
Diffie-Hellman characteristics
In the Diffie-Hellman cryptosystem, two parties
create a symmetric session key to exchange data
without having to remember or store the key for
future use.
They do not have to meet to agree on the key; it can
be done through the Internet.
The two parties need to choose two numbers p and
g, both number announced to the public.
P
large prime number
g random number
Diffie-Hellman Cont.
Diffie-Hellman is a very sophisticated symmetric-key
creation algorithm.
If a and b are very large numbers, it is extremely difficult
for Eve to find the key, knowing only p and g.
An intruder needs to determine a and b if R1 and R2 are
intercepted.
The key will be changed each time the two parities need to
communicate.
Diffie-Hellman