Modern cryptography

Download software:


Subject Area:                                  Modern cryptography


1.     Aims

The aims of this practical work are

  • To reinforce understanding of the DES symmetric key cipher.
  • To reinforce understanding of the AES symmetric key cipher.
  • To illustrate the differences between the DES and AES encryption algorithms.
  • To highlight the vulnerability of the ECB and CBC modes of operation of a symmetric block cipher to attack.
  • To reinforce understanding of the Diffie-Hellman key exchange algorithm.
  • To reinforce understanding of the behaviour and use of hash functions.
  • To reinforce understanding of the RSA public key cipher.
  • To reinforce understanding of public key infrastructure
  • To reinforce understanding of hybrid ciphers.


2.     Learning Outcomes

After completing this practical work you will

  • Be aware of the main differences between DES and AES.
  • Understand the advantages of the CBC mode of operation over the ECB mode of operation of a symmetric key block cipher.
  • Understand the vulnerability of the ECB mode of operation and the CBC modes of operation of a symmetric key block cipher to cut and paste attacks.
  • Understand the significance of the key length of a modern cipher.
  • Understand the Diffie-Hellman key exchange algorithm and its vulnerability to attack.
  • Understand how to do a byte addition attack on a hash function and its significance in practice.
  • Understand how the RSA key cryptosystem operates upon its input by treating it as an integer value. Understand the significance of the size of the value of the modulus used in RSA.
  • Know what the typical content of a Digital Certificate looks like.
  • Have an appreciation of the time RSA operations take.
  • Have worked through the steps taken in encrypting and decrypting a document using a hybrid cipher.



3.     Using DES with CrypTool

In Cryptool open a new file, type a plaintext message (of more than 32 characters) and save the file. Next click from the menu Crypt/Decrypt > Symmetric (modern) > DES (ECB). This presents a key entry window. The key entry must be 64 bits long (but only 56 bits will be used in the actual key), which equates to 16 hexadecimal figures. Enter a key of your choice that you can remember. Select Encrypt and there should be presented a window showing the data encrypted in hexadecimal form and its corresponding ASCII representation. Save and then close the window displaying the original message. To decrypt the ciphertext select Crypt/Decrypt > Symmetric (modern) > DES (ECB), enter the key used to encrypt the file in the key selection window displayed and select Decrypt.

Q1. Provide screenshots of the message and the ciphertext. Provide a screenshot of the window showing the decrypted ciphertext. Give the key you used.

[2 marks]

Encrypt the same plaintext message using the same process and the same key as above only selecting Crypt/Decrypt > Symmetric (modern) > DES (CBC) instead.

Q2. Provide a screenshot of the resulting ciphertext. Compare the ciphertext with that obtained using DES (ECB), and report what you notice.

[3 marks]

Comparison of ECB and CBC

Now create a new plaintext file, choose an 8 letter word (or string of 8 characters) and type it in, now copy and paste this word until there are 24 repetitions of it and save the file. Encrypt this with the ECB variant of the DES cipher


Q3. Provide a screenshot of the ciphertext and report what you notice about it.

[2 marks]

Close the window showing the ciphertext of Q3. and then encrypt the plaintext file with the CBC variant of the DES cipher.

Q4. Provide a screenshot of the ciphertext obtained using the CBC variant of DES, compare it with that of Q3. and report what you notice. What do you think the significance of what you notice is?

[3 marks]

Select Indiv. Procedures > Visualization of Algorithms > DES and watch through the whole of the demonstration of DES provided. This should help to reinforce your understanding of this cipher.

Q5. What impression do you get of the nature of the DES encryption process from the demonstration?

[2 marks]


4.     AES demonstration

Select Indiv. Procedures > Visualization of Algorithms > AES > Rijndael Animation and watch through the whole of the demonstration of AES provided. This should help to reinforce your understanding of this cipher.

Q6. What main differences do you notice between the AES encryption process and the DES encryption process from the demonstration?

[5 marks]

Q7. Compare the total size of the S boxes of DES with that of the S box of AES.

[3 marks]


5.     Analysis of modern symmetric key ciphers

Q8. Encrypt a plaintext message of at least 32 characters with DES (ECB), DES (CBC), and AES. For each ciphertext use the corresponding analysis tool provided in Cryptool to attempt to decrypt the ciphertext. In each case give the time it will take to do the decryption (provided by the analysis tool). Compare the three values and explain their relative magnitudes.

[5 marks]



6.     Diffie-Hellman Key exchange demonstration

Q9. In cryptool select

Indiv. Procedures>Protocols>Diffie-Hellman key demonstration

Work through the Diffie-Hellman demonstration starting by clicking on the box Set public parameters and then generate a prime number with a bit length of 128 bits. At each set in the demonstration that follows give the parameters you obtain and explain how these parameters are determined.

[10 marks]


7.     Meet-in-the-middle attack against Diffie-Hellman

Q10. Let YA = gXA mod p, and YB = gXB mod p be Diffie-Hellman exchanged values of Alice and Bob, respectively. Secret values XA and XB and remain known only to their respective owners Alice and Bob. Suppose that the Attacker wants to establish a single Diffie-Hellman key, KABM = gXAXBXM mod p, that the Attacker, Alice and Bob all share. XM is a secret value known only to the attacker. How does the attacker accomplish this? Explain your answer.

[5 Marks]


8.     “Cut-and-Paste” attack on ECB and CBC modes

Q11. Consider the following message M:


Break the message (plaintext) up into 64 bit long plaintext segments (M1 M2 … Mk).

Note that each letter in the message is an 8 bit ASCII character. Each“space” (_) counts as a single ASCII character.

Use  ̺  to denote blank characters. For example, the first 64 bit plaintext segment is

M1 = Ann’s_sa

[2 marks]

Q12. Using CrypTool, encrypt the above message with DES in the ECB mode using key

K = 01 23 45 67 89 AB CD EF

Write down resulting 64 bit ciphertext blocks C1 C2 … Ck.

[1 mark]


Q13. 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.

[3 marks]

Q14. Repeat steps 2-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.

[4 marks]

Q15. Your task is to cause a controlled change in the decrypted message by modifying an appropriate CBC ciphertext block.


Use CrypTool and encrypt message


with DES in the CBC mode. Choose the encryption key at will.

In the resulting ciphertext sequence modify an appropriate ciphertext block so that it causes the following change in the decrypted message: £32000 to £69000.

Provide details of your actions. (Hint: Use CrypTool to accomplish this task.) Do all ciphertext blocks decrypt correctly after this modification? Explain your answer.

[4 marks]


Q16. Does the CBC (and/or ECB) mode of encryption ensure data integrity? Please explain using experience gained from the present and the previous task.

[2 marks]


9.     SHA-1

Create a new document in CrypTool by clicking on the icon “New”. Write some text in the new document (of at least 32 characters) and save it.  Next click from the menu Indiv. Procedures > Hash > Hash Demonstration to open the Hash demonstration window. Select the hash function SHA-1

Q17. Modify the text of your new document that appears in Modified document window and observe what happens to the hash value of the modified document. Explain your observation.

[3 marks]


Save startingexample-en under a different name. Modify the renamed file and save the resulting document under a different name. Use CrypTool to find a collision in the first (most significant) 32 bits of a hash value produced by SHA-1 of renamed copy of startingexample-en and the first 32 bits of the hash value of the modified version of it. In main menu click Analysis > Hash > Attack on the Hash Value of the Digital Signature and click on Options and set the necessary parameters and apply them.

Q18. Provide the messages which collide in the first 32 bits.  Explain why the attack strategy is not a problem in practice. Does the attack strategy differ from that of a birthday attack and if so how?

[4 marks]


10. RSA demonstration

Demonstration material for the RSA cipher may be accessed through Indiv. Procedures > RSA Cryptosystem > RSA Demonstration or Crypt/Decrypt > Asymmetric > RSA Demonstration. This presents a window with a series of options.

Make sure that the radius option of using p and q is selected, not the N and e option.

To run the demonstration you need to enter some prime numbers for p and q. As thinking of large prime numbers can be a daunting task, CrypTool has included a prime number generator which can be accessed by clicking the button Generate prime numbers. Here make sure the option for independent values is selected.

The algorithm used does not really matter as they all produce prime numbers. For both p and q for the lower limit value use 500 and for the upper limit value 1000. It is worth noting here that these limits may also be entered in the form of binary length, using the notation 2^x where x is the number of binary bits used to represent a number.

Once all that has been completed click Generate prime numbers, and prime numbers will be generated, this may be clicked several times to generate different numbers. Select Apply primes and these will be entered as the values for p and q. The values for N and Ø(N) will be automatically calculated. Now enter a value for e, this should be coprime to Ø(N).

Q19. Give your numbers for p, q, and e.

[2 marks]

Select input as text, and enter as the message you wish to be encrypted, a word or phrase (of at least 8 characters), and then select Encrypt.


Q20. Give the message you encrypted and the corresponding ciphertext.

[2 marks]

Copy the ciphertext of Q20, select input as numbers, and paste the ciphertext into the white ‘input’ box then select Decrypt. You should see your original message decrypted.

Q21. Give a screenshot of the RSA demonstration screen showing your plaintext in the plaintext box for the input as numbers option.

[1 mark]

Run the RSA demonstration again encrypting the same message as before but this time generating prime numbers using lower and upper limits for p and q of 10,000 and 100,000, respectively.

Q22. Give the ciphertext you obtain. What do you notice about the segment size of this ciphertext compared to that of Q20? Explain what you notice.

[3 marks]

Q23.  How secure is the RSA modulus

N = 4960345275737677027 ? Justify your answer.

[2 marks]

11. Public Key Infrastructure

Select Digital Signatures/PKI > PKI > Generate/Import Keys. This is where you can create a pair of asymmetric keys, one public and one private, using user details to do so.  The user details are used in the creation of a Digital Certificate which associates the key pair to you. Three ciphers are available RSA, DSA and elliptic curve. Use RSA and select a bit size of 2048 bits. Enter the user details requested on the right. Once all this has been done select Generate new key pair (at this point you may be required to move the mouse so as the system has some data to generate a random input). To view the public key you have generated and the corresponding digital certificate select Digital Signatures/PKI > PKI > Key Display/Export Keys.

Q24. Give the public key you have generated. Describe the information given in the Digital Certificate

[5 marks]

Now that an asymmetric key pair is available you may encrypt/ decrypt data using the RSA cipher. Open a text file with CrypTool that contains at least 1000 words (create a suitable file if you have to). Select Encrypt/Decrypt > Asymmetric > RSA Encryption. Check the box Display the Encryption Time. Select the line identifying your newly created key and then press Encrypt. The encrypted form of the text should appear.


Q25. Give the time it took to encrypt your file.

[1 mark]

Now decrypt the encrypted file. To do this select Encrypt/Decrypt > Asymmetric > RSA Decryption

Q26. Give the time it took to decrypt your file. How does the decryption time compare with the encryption time? What extra thing did you need to do to decrypt that you did not need to do to encrypt?

[4 marks]

Note that to remove the hexadecimal representation from the view of the decrypted file and display the message in a more readable way, select View > Show as Text, and should you wish to revert to the hexadecimal view select View > Show as HexDump.

12. Hybrid encryption

This uses both symmetric and asymmetric ciphers. Select Encrypt/Decrypt > Hybrid > RSA-AES Encryption Then a GUI will be presented. This display demonstrates the processes of hybrid encryption in an easy to understand way.

Click on the Generate session key button, you may be asked again to move the cursor for random input. Once successfully completed this button should turn green and the session key will have been generated. Click on the Select asymmetric key button and choose the key you made during the RSA encryption exercise. Now click on the Open document button and open a text file of your choice, to view the text of your document click on the Document button. Click on the remaining two red boxes, and then on Save. You should now see your data encrypted with the hybrid cipher.

Q27. Provide a screenshot of the encrypted document.

[1 mark]

To decrypt the encrypted document select Encrypt/Decrypt > Hybrid > RSA-AES Decryption. Read the instructions shown and select Continue, then select the asymmetric key pair used in encrypting the document and enter the PIN number used to open it. Read the dialogue shown and press continue. Selecting Continue once more, you can see the AES session key used to encrypt the document, and then press Decrypt.

Q28. Describe the information shown in the dialogue boxes that appears when you carry out the above steps. Explain why hybrid encryption is widely used.

[6 marks]

13. Conclusions

Q29. Give the major conclusions that you draw from this exercise.

[10 marks]

[Total of 100 marks available]

Dr. T. Itagaki


Looking for help with your homework?
Grab a 30% Discount and Get your paper done!

30% OFF
Turnitin Report
Title Page
Place an Order

Calculate your paper price
Pages (550 words)
Approximate price: -