Cryptool Lab
Cryptool Lab
ASYMMETRIC CRYPTOGRAPHY
Exercise 1
In this exercise we will focus on modern ciphers, primarily on the most prominent
block cipher DES. We will study a relationship between DES and its extension 3-DES
(triple DES). Recall, 3-DES was introduced in order to compensate for a short
encryption key (only 56 bits) in the original DES cipher. 3-DES is still widely used for
protection of data confidentiality. In October 2000, Rijndael encryption algorithm (AES)
was chosen as a more robust and more flexible replacement of the DES encryption
algorithm. Similar to DES, AES is also a block cipher but it supports a variable block
length and a variable key length (i.e., 128, 192 and 256 bits).
We will further study two basic operation modes of block ciphers, namely, ECB and
CBC. More specifically, we will show that it is possible to rearrange the ECB and
CBC ciphertext blocks in such a way that all (or some) of the blocks decrypt
correctly. This is a well-known cut-and-paste attack.
Create a new document in CrtypTool and fill it with a longer English text. Alterna-
tively, open an existing English text. Save this document for later reference.
In the main menu, click on the View submenu and select As HexDump. This is
to convert ASCII representation of the plaintext document into the cor-responding
hexadecimal representation.
In the main menu, open the Analysis submenu and select Tools for Analysis
Encrypt the plaintext document (English text) using the DES cipher. In Cryp-Tool
click on the window with the plaintext document in order to make it ac-tive. In the
main menu, under the Crypt/Decrypt submenu select Symmetric (modern) . DES
CBC.... Enter the encryption key and encrypt the plaintext document.
Repeat step 2 above to obtain the histogram of the encrypted text (ciphertext).
Compare the result with the histogram obtained in step 2. Describe/explain your
observations.
Task 1.2. Histogram Analysis of the Caesars Cihper
Repeat all the steps from the previous
task, while using Caesars cihper with an
ar-bitrary key instead of the DES cipher.
Compare the obtained results with the
results from the previous task.
Describe/explain your observations.
Task 1.3. Triple DES (3-DES)
Assume that a message m is encrypted using 3-DES (in the ECB mode) with the
following key (hex value):
K = 11 22 33 44 55 66 77 88 AA BB CC DD EE FF FF FF
The encrypted message is to be decrypted using only regular 1-DES (not 3-DES).
Explain how is this done.
Use CrypTool and encrypt your name with 3-DES in the ECB mode under the
following two encryption keys:
K1 = 11 22 33 44 55 66 77 88 AA BB CC DD EE FF FF FF
K2 = 11 22 33 44 55 66 77 88 11 22 33 44 55 66 77 88
Decrypt resulting ciphertexts using 1-DES cipher. Provide any intermediate re-sults
that you obtain. One among the keys K1 and K2 enables fast decryption with the
1-DES cipher (a single application of 1-DES). Which one? Please explain your
answer.
C
i
=
D(K, Ci), i = {1, 2, . . . , k} .
Similarly, for the CBC mode we have:
C1
= E(K, M1 IV)
Ci
= E(K, Mi Ci1), i = {2, 3, . . . , k}
M
1
=
D(K, C1) IV
Mi
=
D(K, Ci) Ci1, i = {2, 3, . . . , k} .
Break the message (plaintext) up into 64 bit long plaintext segments (M 1 M2...
Mk). Note that each letter in the message is an 8 bit ASCII character; each space
(blank) counts as a single ASCII character. Use t sign to denote blank characters. For
example, the first 64 bit plaintext segment is M 1=Bobstsa .
2. Using CrypTool, encrypt the above message with DES in the ECB
mode using key K = 11 22 33 44 55 66 77 88. Write down resulting 64 bit
ciphertext blocks C1 C2... Ck.
Exchange ciphertext blocks C1 and C4 in the above sequence of ciphertext blocks to obtain
the following sequence of ciphertext blocks:
C4 C2 C3 C1 C5... Ck
Decrypt the resulting ciphertext using the key from step 2. What
message do you obtain? Please explain.
Repeat steps 1-3 but now use DES in the CBC mode. Contrast the decrypted text with the one
obtained when the ECB mode is used. Explain your observations.
with DES in the CBC mode. Choose the encryption key at will.
that it causes the following change in the decrypted message: $15000 $.5000. Provide details
of your actions. (Hint: Use CrypTool to accomplish this task.)
Exercise 2
In this exercise we will focus on asymmetric or public key cryptography.
We will study some important properties of a (textbook) RSA public key
cryptosystem. We will demonstrate certain attacks against RSA -
factoring-based and chosen-ciphertext attack. Finally, we will touch
upon the Die-Hellman key exchange protocol and its security in face of
passive and active attacks.
<space>ABCDEFGHIJKLMNOPQRSTUVWXYZ ,
that is, there are in total 27 dierent plaintext elements. Next, the
alphabet elements are coded as follows:
<space> 0
1
2
.
..
26 .
Depending on the bit length of the RSA modulus N and the selected
alphabet, in CrypTool you can adjust the block length used with RSA
encryption. Now, assume that we want to encrypt plaintext: MARIO.
Assuming that we want to work with block of length 2, we obtain the
following blocks:
MA#RI#O<space> .
13 01 # 18 09 # 15 00 .
Finally, b-adic, that is, 27-adic coding of a numerical representation of the message
is obtained according to the following formula:
You are asked to encrypt your name using RSA with a small modulus N
(that is, N < 100000). Choose N such that the length of the resulting RSA
modulus N allows you to work with blocks of length 2. Use CrypTool to
accomplish this as follows:
Figure 4: CrypTool: The RSA Cryptosystem.
Click on button Options for alphabet and numeric system... to open Op-tions for
RSA Encryption (Figure 5)(right).
Show that CrypTool RSA encryption works by encrypting the first block of the
message manually. You are allowed to use only multiplication and squaring
operations (and of course your calculator). In order to make this process man-
ageable, use reduction by modulo property, that is,
After decryption of a given ciphertext, we have to decode the result back to its
initial plaintext representation. How would you do this? Decode 354 into a
the attacker can easily recover any message encrypted with the victims
private key, without ever learning this private key.
e
X = (C 2 ) mod N ,
gives it to the victim and asks her to sign it. The victim signs message X with its
private key and sends the result Y back to the attacker.
d
Y = X mod N
Using Y and equation (1), the attacker can retrieve the encrypted
message M as follows:
d
X =
e d
(C mod N) (2 mod N)
d
(Me
mod N) (2 d mod N)
(2
M)e mod N
ed
=
(2 M)
mod N
= 2M.
1. Show by example that equation (1) holds for the RSA encryption algorithm. Please provide
details of your solution. Use CrypTool to accomplish this task.
2. Demonstrate by example the chosen ciphertext attack against RSA. Please pro-vide details of
your solution. Use CrypTool to accomplish this task.
(N) = (p 1)(q 1) .
1
d=e mod (N) .
Decrypt the ciphertext given below knowing that the public key e is 11 and the RSA
modulus N is 40741. The plaintext alphabet is encrypted using the block length of 2 and
27-adic coding (for details on encoding please check Task 3.1).
(Hint: Use CryptTool to factor the modulus N. In the main menu, under Anal-
ysis) submenu, select Asymmetric Encryption . Factorization of a Number...
and follow instructions therein.
01437 # 32647 # 36721 # 14238 # 24974 # 27041 # 01170 # 31888 # 08891 # 20670 #
07453 # 36364 # 38274 # 06244 # 11809 # 28159 # 12942 # 30673 # 21533 # 12400 #
18298 # 34309 # 36364
(Note: This problem originally appears in book Information Security: Principles and Practice by Mark Stamp.) Assume
that Malice mounts the
XA
MITM attack on Die-Hellman key exchange protocol as illustrated in Figure 6. Let YA = g
X
mod p, and YB = g B mod p be Die-Hellman public keys of Alice and Bob, respectively.
Private keys XA, XB and XM remain known only to the
respective owners Alice, Bob and Malice. Suppose that Malice wants to establish
X X X
a single Die-Helmman key, KABM = g A B M mod p, that he, Alice and Bob all
share. Does the attack illustrated in Figure 6 accomplish this? Explain your
answer.
Alice
Y
- A
Malice
XAXM
g mod p-
Bob
g
XBXM
mod p
Y
B