2018-2019 Spring COMP434 Final Answer Keys
2018-2019 Spring COMP434 Final Answer Keys
Department of Mathematics
****************************************************************************
COMP434 Cryptography and Network Security
Final Examination
Answer keys
****************************************************************************
Question 1. Given a plaintext message 𝑝𝑝 = (𝑝𝑝1 , 𝑝𝑝2 , … ) where 𝑝𝑝𝑖𝑖 is a letter in some alphabet and
invertible 𝑚𝑚 × 𝑚𝑚 matrix 𝐻𝐻, Hill cipher represents 𝑝𝑝𝑖𝑖 by numeric value 𝑥𝑥𝑖𝑖 ∈ ℤ𝑛𝑛 (ℤ𝑛𝑛 =
{0,1, … , 𝑛𝑛 − 1}) and encrypts plaintext as 𝑦𝑦 = 𝐻𝐻 ∙ 𝑥𝑥 (𝑚𝑚𝑚𝑚𝑚𝑚 𝑛𝑛), where 𝑥𝑥 and 𝑦𝑦 are plaintext and
ciphertext column vectors. Similarly, 𝑦𝑦 is decrypted as 𝑥𝑥 = 𝐻𝐻 −1 ∙ 𝑦𝑦 (𝑚𝑚𝑚𝑚𝑚𝑚 𝑛𝑛). Consider a scenario
where a cryptanalyst can break the system and obtain matrix 𝐻𝐻. Which parameters of the system
and at which capacity should be known to guess 𝐻𝐻? What matrix operation could be performed to
recover 𝐻𝐻?
Answer
Hill cipher can be obviously broken, knowing only 𝑚𝑚 distinct plaintext and ciphertext pairs (𝑥𝑥, 𝑦𝑦)
and by computing 𝐻𝐻 = 𝑌𝑌 ∙ 𝑋𝑋 −1 (𝑚𝑚𝑚𝑚𝑚𝑚 𝑛𝑛), where 𝑋𝑋 and 𝑌𝑌 are the matrices composed of 𝑚𝑚 columns
of 𝑥𝑥 and 𝑦𝑦, respectively. Whenever 𝑋𝑋 is invertible the opponent can obviously compute the
unknown key as 𝐻𝐻 = 𝑌𝑌 ∙ 𝑋𝑋 −1 (𝑚𝑚𝑚𝑚𝑚𝑚 𝑛𝑛) and consequently break the cipher. If the 𝑋𝑋 is not invertible
then cryptanalyst keeps on collecting 𝑚𝑚 plaintext and ciphertext pairs until the resulting matrix is
invertible. When 𝑚𝑚 is unknown, cryptanalyst might try the procedure for 𝑚𝑚 = 2,3,4 until the key
is found.
Question 2: Encryption with double columnar transposition technique with permutation 4312567
results in ciphertext NSCY AUOP TTWL TMDN AOIE PAXT TOKZ. Decrypt the ciphertext.
Solution
We enter ciphertext according to the key 4312567 columnwise and read output rowwise from left
to right and from up to down.
Plaintext: ATTACKPOSTPONEDUNTILTWOXYZ
(b) Find a legal RSA public key pair for this 𝑝𝑝 and 𝑞𝑞.
Solution
(a) The two factors of 𝑛𝑛 are 3 and 17. Thus, 𝑝𝑝 = 3, 𝑞𝑞 = 17and 𝜓𝜓(𝑛𝑛) = (𝑝𝑝 − 1)(𝑞𝑞 − 1) = 2 ×
16 = 32.
(b) gcd(𝑒𝑒, 51) = 1. An example of 𝑒𝑒 = 5. 5𝑑𝑑 ≡ 1 𝑚𝑚𝑚𝑚𝑚𝑚 51 ⇒ 𝑑𝑑 = 41.
(c) There are 31 possible values for 𝑒𝑒. All these values are indicated in white cells.
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
Question 4: Suppose Alice sends authenticated secret message to Bob. Bob authenticates the
same plaintext while keeping Alice’s digital signature on it. Then Bob sends the secret message,
which is authenticated by Alice and himself, to Cathy. On receipt of the secret message Cathy
reads it and gets sure that the message is authenticated by Alice and Bob. Let private and public
keys used by Alice, Bob and Cathy are represented by KRA, KUA, KRB, KUB, KRC and KUC,
respectively, and let X stand for the plaintext, write a sequence of actions performed by Alice,
Bob and Cathy in pseudomathamatical form.
Solution
𝑌𝑌 = 𝐸𝐸𝐾𝐾𝐾𝐾𝐵𝐵 (𝐸𝐸𝐾𝐾𝐾𝐾𝐴𝐴 (𝑋𝑋)) is a confidental message authenticated by Alice and sent to Bob.
𝑍𝑍 = 𝐸𝐸𝐾𝐾𝐾𝐾𝐶𝐶 (𝐸𝐸𝐾𝐾𝑅𝑅𝐵𝐵 �𝐸𝐸𝐾𝐾𝐾𝐾𝐴𝐴 (𝑋𝑋)� is confidential message authenticated by Bob and Alice and sent to
Cathy.
𝑋𝑋 = 𝐷𝐷𝐾𝐾𝑅𝑅𝐶𝐶 (𝐷𝐷𝐾𝐾𝑈𝑈𝐵𝐵 �𝐷𝐷𝐾𝐾𝑈𝑈𝐴𝐴 (𝑍𝑍)� is plaintext which Cathy decrypts with Bob and then Alice’s public
keys.
Solution
In diffusion, the statistical structure of the plaintext is dissipated into long-range statistics of the
ciphertext. This is achieved by having each plaintext digit affect the value of many ciphertext
digits; generally, this is equivalent to having each ciphertext digit be affected by many plaintext
digits. On the other hand, confusion seeks to make the relationship between the statistics of the
ciphertext and the value of the encryption key as complex as possible, again to thwart attempts to
discover the key.