You are on page 1of 3

Spring 2024 Total Marks: 20

CS609: System Programming Due Date: 30


Assignment No. 01 April 2024

Instructions:
Please read the following instructions carefully before submitting an assignment. It should be
clear that your assignment will not get any credit if:

▪ The submitted assignment does not open or the file is corrupt.

▪ You have not fulfilled all the requirements described in problem statement.

▪ Assignment is copied (partial or full) from any source (websites, forums, students,

etc.). Strict action will be taken in this regard.


Submission Guidelines:

1. You need to upload the following two files in a single .zip or .rar format:
(i) .C file (C language source file containing code)
(ii) .exe file (executable file, created after compilation)
2. Any other file type (.docx, .txt, .pdf, .jpeg, .gif) shall not be acceptable and you would get
zero marks for this.

Objectives:
The objective of this assignment is to provide hands-on experience of System Programming
concepts including:

● Opening and handling files

● Basic understanding of Windows API functions for file encryption

● Understanding System error and its reporting to user

Topics Covered:
1 to 37
Problem Statement:

Develop a file encryption utility program (in C language) for the Windows operating system using only
the Windows API. The program should provide a command-line interface (CLI) for users to encrypt and
decrypt files using AES-256 encryption algorithm.
Assignment Tasks:
1. Design the command-line interface for the file encryption utility, including options for
encrypting and decrypting files, encryption key, and providing input and output file paths.
Program should first ask the user whether he/she wants to encrypt or decrypt a file.
a. In case of encryption:
i. It should ask for source file path, encryption password and destination path for
encrypted file.
ii. For destination file path, it should also tell the user to press “s” for same path as
the source file (if he/she does not want to enter the new path).
iii. Program should append the word “Encrypted” after the source file name. For
example, if source file name is “Test.txt” then after encryption, its name should
be “TestEncrypted.txt”.
b. In case of decryption:
i. Program should ask for source file path.
ii. It should then ask for decryption password.
iii. If password matches, it should decrypt the file and remove the word
“Encrypted” from its file name.
iv. If password in incorrect, it should show the proper error message.
v. It should then ask for destination file path. it should also tell the user to press “s”
for same path as the source file (if he/she does not want to enter the new path).
If a file with the same name already exits in the destination directory, then your
program should append the word “Decrypted” at the end of the decrypted file.
Otherwise, there is no need to append any word.
2. Implement file encryption functionality using only Windows API cryptographic functions, such
as CryptEncrypt and CryptDecrypt, to perform symmetric encryption.
3. Handle errors gracefully using Windows API error handling functions, providing informative
messages to users.
Note:
 You should print your name and student ID at the top of output screen. You will be awarded
zero marks if the mentioned name and student ID is not yours.
 In case of any assignment related query, please do not post any question on MDB. Contact at
CS609@vu.edu.pk for asking assignment related questions.

---BEST OF LUCK---

You might also like