0% found this document useful (0 votes)
77 views

Midterm Solution

Uploaded by

saitejagoud445
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Midterm Solution

Uploaded by

saitejagoud445
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

CMPE/EE209: Network Security (Section 02)

Fall 2021

Midterm
Oct. 13, 2021, 4:00pm-5:15pm

Name: ID#:

This is a close-book, close-notes exam. For this exam, you may use a calculator. All other
electronic devices (e.g., cellular phones, laptops, PDAs) are prohibited. If you have a cellular
phone, please turn it off prior to the start of the exam to avoid distracting other students. You can
bring a one-page handwritten cheatsheet (double-sided 8.5 by 5.5 inches).

The exam contains 5 questions for a total of 100 points. Please answer the questions in the spaces
provided. If you need additional space, use the back of the page on which the question is written
and clearly indicate that you have done so.

You will have75 minutes to complete this exam.

Q1:Multiple choice /20


Q2:Short questions (concepts)
/15
Q3:Classical Substitution /15
Ciphers
Q4:Symmetric Key /35
Encryption
Q5:Asymmetric Key /15
Encryption
TOTAL SCORE /100
1. (20 points, 5 points per part) Multiplechoice

a. RC4 is a B cipher.

A. block symmetric B. stream symmetric

C. block asymmetric D. stream asymmetric

b. A B takes place when one entity pretends to be a different entity.

A. replay B. masquerade

C. service denial D. passive attack

c. Asymmetric encryption can be used for A .

A. both confidentiality and authentication

B. neither confidentiality nor authentication

C. confidentiality

D. authentication

d. Based on current knowledge, which of the following problems is “difficult” to solve? A


problem is considered to be difficult to solve when there is no known efficient algorithm that
solves it. C

B. Given a large prime n, finding 𝜙(𝑛)


A. Given a large prime p and an integer a, finding an integer b such that (a * b) mod p = 1

𝑎𝑥 𝑚𝑜𝑑 𝑝= b
C. Given integers a and b and a large prime p, finding an integer x such that

D. None of the above


2. (15 points, 5 points per question) Answers the following questions in a couple of sentences.

a. What is the main difference between block cipher and stream cipher?

Stream ciphers work on a bit or byte of the message at a time


Block ciphers Encrypt a block of plaintext as a whole to produce same sized ciphertext

b. What is the main difference between symmetric key encryption and asymmetric key
encryption?

symmetric key encryption uses the same key for encryption and decryption
there are a pair of keys (public key and private key) used asymmetric key encryption. One
used for encryption, the other one used for decryption

c. Distinguish between passive attacks and active attacks. What are the various forms of
these two attacks?

Passive Attack: Make use of information, but not affect system resources, relatively hard to detect,
but easier to prevent

Forms: Release message contents, Traffic analysis

Active Attack: Alter system resources or operation, relatively hard to prevent, but easier to detect

Forms: Masquerade, Replay, Modification, Denial of service


3. Classical Substitution Ciphers
a. (10 points) Use Vigenere Cipher to encrypt the plaintext “NETWORK” using the key
string “CMPE”. Show your steps to arrive at the Ciphertext. Do not consider the blank
spaces during encryption.
A=0,B=1,C=2,D=3,E=4,F=5,G=6,H=7,I=8,
J=9,K=10,L=11,M=12,N=13,O=14,P=15,Q=16,R=17,
S=18,T=19,U=20,V=21,W=22,X=23,Y=24,Z=25

Plaintext: N E T W O R K
Converted: 13 4 19 22 14 17 10
Key: C M P E C M P
Converted: 2 12 15 4 2 12 15
15 16 8 0 16 3 25
Ciphertext: P Q I A Q D Z

Solutions: PQIAQDZ
b. (5 points)
Using Playfair cipher (with keywords: LARGE) to Decrypt the message: AQUTENKQ

L A R G E

B C D F H

I/J K M N O

P Q S T U

V W X Y Z

AQ---WK
UT---TS
EN---GO
KQ---CK

Plaintext: wktsgock
3. Symmetric Key Encryption

a. (10 points) mode of operations


Table 1 shows all possible plaintext/ciphertext block pairs when using a symmetric key
encryption algorithm E using key k.

Plaintext Ciphertext Plaintext Ciphertext


0000 1100 1000 0001
0001 1111 1001 0000
0010 0111 1010 0101
0011 1110 1011 0100
0100 1011 1100 0011
0101 1001 1101 1000
0110 0010 1110 0110
0111 1101 1111 1010
Table 1: Symmetric cipher

Consider the ciphertext message, C = 0100011100. Assume the IV value is 1111. Show the
steps to Decrypt C if Cipher Feedback Mode with s=2 was used in encryption.

Shift register/I1: 1111


O1= 1010
P1= 10 XOR 01= 11

Shift register/I2: 1101


O2=1000
P2=10 XOR 00=10

Shift register/I3: 0100


O3=1011
P3=10 XOR 01= 11

Shift register/I4: 0001


O4=1111
P4=11 XOR 11= 00

Shift register/I5: 0111


O5=1101
P5=11 XOR 00= 11

Plaintext: 1110110011

b. (15 points )Given the plaintext {00112233445566778899AABBCCDDEEFF} and


the current round key {000102030405060708090A0B0C0D0E0F}:

a). Show the value of State after

AddRoundKeys. State:
00 40 80 C0
10 50 90 D0
20 60 A0 E0
30 70 B0 F0

b). Show the value of State after SubBytes.

Table 2. S-box for SubBytes

State:
63 09 CD BA
CA 53 60 70
B7 D0 E0 E1
04 51 E7 8C
c). Show the value of State after

ShiftRows. State:
63 09 CD BA
53 60 70 CA
E0 E1 B7 D0
8C 04 51 E7

c. (10 points) Pseudorandom number


generator Consider the following two
generators:

Xn+1 = (6Xn) mod 13


Xn+1 = (7Xn) mod 13

Find the periods of the above two generators using seed x 0=1, respectively.
Which one appears more random to you?

The first generator yields the sequence:


1, 6, 10, 8, 9, 2, 12, 7, 3, 5, 4, 11, 1, . . . period 12
The second generator yields the sequence:
1, 7, 10, 5, 9, 11, 12, 6, 3, 8, 4, 2, 1, . . . period 12
Because of the patterns evident in the second half of the latter sequence,
so it is less random than the first sequence
4. Asymmetric key encryption
a. (10 points) Perform encryption using the RSA algorithm for the

following: n=33; e = 3; M = 3

C=3^3 mod 33 =27 mod 33= 27


b. (5 points) Alice and Bob perform a Diffie–Hellman key exchange with prime q=19 and α
= 2, Alice chooses her private key as XA=5, and Bob chooses his private key as XB=3, find
the secrete value K that they got after the Diffie–Hellman.

YA=32mod 19=13
K= 2197 mod 19=12

YB= 8 mod 19= 8


K= 32768 mod 19=12

You might also like