Computer & Network Security

Sep 27, 2006 - Suppose Alice and Bob have RSA public keys in a file on a server. ... replaced the public keys Bob and Alice won't be able to decrypt correctly ...
297KB taille 6 téléchargements 377 vues
Computer & Network Security Tutorial 3 date : 27 September 2006

HKU - Computer & Network Security

Table of Contents 1. Question 1........................................................................................................................1 1.1. Problem.....................................................................................................................1 1.2. Solution.....................................................................................................................1 2. Question 2........................................................................................................................2 2.1. Problem.....................................................................................................................2 2.2. Solution.....................................................................................................................2 2.2.1. Generating the keys...........................................................................................2 2.2.2. Generating the cipher........................................................................................2 2.2.3. Decrypting..........................................................................................................2 3. Question 3........................................................................................................................3 3.1. Problem.....................................................................................................................3 3.2. Solution.....................................................................................................................3 4. Question 4........................................................................................................................4 4.1. Problem.....................................................................................................................4 4.2. Solution.....................................................................................................................4 5. Question 5........................................................................................................................5 5.1. Problem.....................................................................................................................5 5.2. Solution.....................................................................................................................5 5.2.1. Extended Euclid Algorithm.................................................................................5 5.2.1.1. Goal.............................................................................................................5 5.2.1.2. Principle......................................................................................................5

I

HKU - Computer & Network Security

1.

Question 1

1.1.

Problem

Given a RSA key pair with public key (77, 119) and private key (5, 119), how many squaring and multiplication operations do we need to perform to encrypt a plain text M = 66 if the square-and-multiply technique is used for exponentiation?

1.2.

Solution

Given that (m has to be inferior to n): e

c=m mod n m=66, e=77, d=5, n=119 77 c=66 mod 119  1001101 c=66 mod 119 bin

If we use the squaring and multiplication method we will need:

NumberOfBitsIne =7, need 7−1 squaring NumberOfBits1Ine =4, need 4−1 multiplications

1

HKU - Computer & Network Security

2.

Question 2

2.1.

Problem

RSA Encryption/Decryption: if p=2, q=5, e