Cryptography
SLP at NUAA in July 2025
Hands-On Individual Assignment
General Instruction
1. This is an individual assignment.
3. The Full Name and Student ID Number must be
stated in the email subject and the files specified below
attached as a single zip file.
4. You are allowed to submit only once, so triple check that
you have completed all tasks and attached all required files.
Tools
There are two options of commonly available libraries to use
1. OpenSSL
2. Python CryptoLibrary
Students are, of course, free to write and use their own
implementation of the relevant cryptographic modules, if they
so desire.
Care must be exercised to ensure that the submission package
can be evaluated on its own, without the submitter being
present to explain or argue a case.
Step-by-Step Procedures
1. Get a file of size between 1 to 10 MB and name this file
plaintext file.
• It is your responsibility to ensure that the chosen tool can
handle the file type of plaintext file.
• The file extension depends on the file type.
2. Hash plaintext file using SHA-512.
Output the digest to a file named digest file.hex in
hexadecimal format.
Procedures (continued)
3. Generate an RSA-4096 key pair.
• Output and save the public key in PEM format as
RSA public key.pem.
• Output and save the private key in PEM format as
RSA private key.pem.
4. Sign plaintext file using the RSA private key above and
output as signed file.
Verify the signature by using the RSA public key.
Procedures (continued)
5. Generate an AES-256 key and output the binary string as
AES key.txt.
6. Encrypt the AES key by using the RSA public key and
output as encrypted AES key.txt.
7. Decrypt encrypted AES key.txt by using the RSA private
key and output as a binary string into a file named
decrypted AES key.txt.
Ensure that the content is identical with AES key.txt.
Procedures (continued)
8. Encrypt plaintext file by using the AES key in any
mode of operation of your choice, e.g., Galois Counter
Mode (GCM).
9. Output the encrypted file as ciphertext file and specify
the chosen mode of operation.
• To decrypt the encrypted file, some modes of operation
require additional data (AAD) and initialization vector
(IV).
• You must know how to store, find, and use them.
• Some commands or routines allow for automatic handling of
AAD or IV.
Procedures (continued)
10. Decrypt ciphertext file and save the output as
decrypted file.
11. Output the SHA-512 digest of decrypted file, in
hexadecimal, as digest decrypted file.hex.
The grader will check for correctness by comparing the two
digest files.
Submission Package
Submit the following files in a single zip file containing
plaintext file digest file.hex
RSA public key.pem RSA private key.pem
signed file AES key.txt
encrypted AES key.txt decrypted AES key.txt
ciphertext file decrypted file
digest decrypted file.hex
• Students may add a list of commands or append the source
codes that they use as additional information in the
submission package.
• Doing so is not required but may make it easier for the
grader to assess the submission.
Have Fun
• You are free to discuss with other students.
• Your submission, however, is individual.
• There should not be identical plaintext file.
• If there are n students with very similar submission
packages with the lowest mark being X points, then the
individual mark will be X divided by n.
Enjoy!!
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。