SYSC 4810: Introduction To Network and Software Security Module 2 Assignment
SYSC 4810: Introduction To Network and Software Security Module 2 Assignment
Module 2 Assignment
Fall 2021
Dr. J. Jaskolka Posted: September 23, 2021
Carleton University
Department of Systems and Computer Engineering Due: October 10, 2021
This assignment contains 13 pages (including this cover page) and 8 problems. You are responsible for
ensuring that your copy of the assignment is complete. Bring any discrepancy to the attention of your
instructor.
Special Instructions:
2. Start early as this assignment is much more time consuming than you might initially think!
3. The burden of communication is upon you. Solutions not properly explained will not be considered
correct. Part of proper communication is the appearance and layout. If we cannot “decode” what you
wrote, we cannot grade it as a correct solution.
4. You may consult outside sources, such as textbooks, but any use of any source must be documented
in the assignment solutions.
5. You are permitted to discuss general aspects of the problem sets with other students in the class, but
you must hand in your own copy of the solutions.
6. Your assignment solutions are due by 11:59PM on the due date and must be submitted on Brightspace.
• Late assignments will be graded with a late penalty of 20% of the full grade per day up to 48
hours past the deadline.
7. You are responsible for ensuring that your assignment is submitted correctly and without corruption.
Problem 1 2 3 4 5 6 7 8 Total
Points: 10 10 5 10 5 10 10 10 70
Page 1 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
In this assignment, you will participate in activities related to the operation and use of cryptographic tools and
techniques. This assignment aims to assess your understanding of the basic principles underlying the main
cryptographic concepts and technologies available today, including symmetric and asymmetric encryption,
and digital signatures.
Acknowledgment
This assignment is based off the SEED Labs: “Secret-Key Encryption Lab” and “RSA Public-Key Encryption
and Signature Lab” developed by Wenliang Du at Syracuse University.
Submission Requirements
Please read the following instructions very carefully and follow them precisely when submitting your assignment!
Grading Notes
An important part of this assignment is following instructions. As such, the following grade penalties will
be applied for failure to comply with the submission requirements outlined above:
• Failure to submit an Assignment Report will result in a grade of 0 for the assignment.
• Failure to submit the Source Code files will result in deduction of 10% of the full grade of the assignment.
• Failure to submit the Screenshot Image files will result in deduction of 10% of the full grade of the
assignment.
• Failure of Source Code to compile/run will result in a grade of 0 for the corresponding problem(s).
• Failure to submit any deliverable in the required format (PDF or ZIP) will result in deduction of 5%
of the full grade of the assignment.
Page 2 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
2 Context
MedView Imaging specializes in diagnostic medical imaging (see Figure 1). Diagnostic imaging includes
ultrasound, computed tomography (CT) scans, X-rays (including mammography), magnetic resonance
imaging (MRI), nuclear medicine imaging, and positron emission tomography (PET). When patients are
referred by physicians for diagnostic medical imaging services, radiologists at MedView Imaging perform the
required imaging service and provide a preliminary diagnosis. The images that are obtained from the service
are stored in a central database, along with a short description indicating the nature of the diagnosis from
the radiologist. When required, the images and diagnostic notes are sent to the attending physician so that
appropriate treatments can be prescribed.
Protected health information (PHI) refers to the demographic information, medical histories, test and
laboratory results, mental health conditions, insurance information and other data that a healthcare
professional collects to identify an individual and determine appropriate care. Because MedView Imaging
is capturing, transmitting, and storing sensitive PHI, it requires a cryptographic solution to protect the
confidentiality of the information. However, MedView Imaging is currently undecided on the specific encryption
algorithms and associated parameters.
Page 3 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
Furthermore, MedView Imaging needs to ensure that the messages that are received by the central database
and subsequently sent to the physicians are authentic and that they cannot be altered in transit. This must
be done to avoid any issues related to incorrectly diagnosing and prescribing incorrect treatments to patients.
For this purpose, they have considered using digital signatures, but are unsure whether this solution will be
suitable for satisfying their security requirements.
MedView Imaging has expressed the following requirements and constraints of their system, which must be
considered in the eventual choices of cryptographic mechanisms.
1. Medical images from an imaging service (e.g., CT, X-ray, MRI, etc.) must be transmitted to the central
database. These transmissions must be encrypted.
2. Messages received by the central database and sent to a physician must be authenticated to ensure
that they are from a trusted imaging unit and radiologist, and that the contents of the message have
not been altered in transit.
3. Performance should be considered, but security is more important as there are serious consequences if
PHI is mishandled.
4. Key distribution and management is not an issue and will be determined based on the recommendations
and eventual selections of the cryptographic mechanisms.
5. The information systems should comply with the Health Insurance Portability and Accountability Act
and NIST Cybersecurity Special Publication 1800-24, Securing Picture Archiving and Communication
System, but verifying and validating compliance with these documents is outside the scope of this
contract.
3 Obligations
At the end of this assignment, you will be required to address the following concerns of MedView Imaging:
1. Provide a recommendation for a cryptographic solution to protect the confidentiality of the PHI (e.g.,
medical images, diagnostic notes, etc.). The recommendation should include a type of encryption,
algorithm, key lengths, cipher modes, etc. Your recommendation must be justified with experimental
results.
2. Provide a recommendation for message authentication. The client has expressed interest in using digital
signatures. You should explain the suitability of this choice by discussing the potential issues with this
choice. If you deem the choice of digital signatures to be unsuitable, recommend an alternative solution.
In any case, your recommendation must be justified with experimental results, or a detailed discussion
of the strengths and limitations of your recommendation.
Page 4 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
*Important Note* It is essential that you set up the virtual machine as early as possible to ensure that
you have time to address any technical difficulties that you may face. The instructor and the TA will not
be able to provide adequate technical support close to the assignment due date.
Page 5 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
2 Background
The openssl enc command can be used to encrypt and decrypt files.
$ openssl enc -ciphertype -e -in plain.txt -out cipher.txt -K key -iv intial_vector
• -ciphertype stands for the cipher and mode to be used. Examples: -aes-128-cbc, -bf-cbc,
-aes-128-cfb, etc.
Some common options for the openssl enc command are provided below:
-in <file> input file
-out <file> output file
-e encrypt
-d decrypt
-K/-iv key/initialization vector in hexadecimal
-[pP] print the key/initialization vector (then exit -P)
You can find the meaning of the command-line options and all of the supported cipher types by typing
man enc or man openssl.
Page 6 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
(c) [2 points] View the encrypted images and draw conclusions: Display the encrypted image
using an image viewing program; an image viewer program called eog is installed on the virtual
machine. Can you derive any useful information about the original image from the encrypted
picture? Explain your observations.
(d) [5 points] Repeat Parts (a)-(c) using brain2.bmp and report your observations. Do you notice
anything different about the results with respect to the original image?
Page 7 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
1 Introduction
RSA (Rivest Shamir Adleman) is one of the first public-key cryptosystems and is widely used for secure
communication. The RSA algorithm first generates two large random prime numbers, and then use them
to generate public and private key pairs, which can be used to do encryption, decryption, digital signature
generation, and digital signature verification. The RSA algorithm is built upon number theories, and it can
be quite easily implemented with the support of libraries.
In this part of the assignment, you will gain hands-on experience with asymmetric cryptography and
the RSA algorithm by generating public/private keys, performing encryption/decryption, and signature
generation/verification. Essentially, you will be implementing the RSA algorithm using the C programming
language.
2 Background
The RSA algorithm involves computations on large numbers. These computations cannot be directly
conducted using simple arithmetic operators in programs, because those operators can only operate on
primitive data types, such as 32-bit integer and 64-bit long integer types. The numbers involved in the RSA
algorithms are typically more than 512 bits long. For example, to multiply two 32-bit integer numbers a
and b, we just need to use (a × b) in our program. However, if they are big numbers, we cannot do that
anymore; instead, we need to use an algorithm (i.e., a function) to compute their products.
There are several libraries that can perform arithmetic operations on integers of arbitrary size. In this
assignment, we will use the Big Number library provided by openssl. To use this library, we will define
each big number as a BIGNUM type, and then use the APIs provided by the library for various operations,
such as addition, multiplication, exponentiation, modular operations, etc.
Page 8 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
• Compute res = a × b. It should be noted that a BN_CTX structure is needed in this API.
BN_mul(res, a, b, ctx);
• Compute modular multiplicative inverse, i.e., given a, find b, such that (a × b) mod n = 1.
BN_mod_inverse(b, a, n, ctx);
Page 9 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
int main () {
BN_CTX *ctx = BN_CTX_new();
BIGNUM *a = BN_new();
BIGNUM *b = BN_new();
BIGNUM *n = BN_new();
BIGNUM *res = BN_new();
// Initialize a, b, n
BN_generate_prime_ex(a, NBITS, 1, NULL, NULL, NULL);
BN_dec2bn(&b, "273489463796838501848592769467194369268");
BN_rand(n, NBITS, 0, 0);
// res = a*b
BN_mul(res, a, b, ctx);
printBN("a*b = ", res);
Compilation
NOTE : the character after - is the letter ℓ, not the number 1; it tells the compiler to use the crypto library.
Problem 3 [5 points]
Deriving the Private Key: An important requirement for asymmetric cryptography is that it should
be computationally infeasible for an adversary, knowing the public key, to determine the private key. In
other words, the private key should remain private. This experiment will demonstrate how to derive the
private key given, knowing the public key and having determined the two prime numbers p and q (in
some way).
Let p, q, and e be three prime numbers. Let n = p × q. We will use (e, n) as the public key. Write a C
program to calculate the private key d. The hexadecimal values of p, q, and e are listed below.
p = CF751B1FA7FD450223CD96CDABE96AC7
q = FD8F0F9D611E28DD688447C0E9A0CDBD
e = 41AC7
It should be noted that although p and q used in this problem are quite large numbers, they are not
large enough to be secure. We intentionally make them small for the sake of simplicity. In practice,
these numbers should be at least 512 bits long (the ones used here are only 128 bits). In your report,
you should explain why this is the case!
Page 10 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
The public keys are listed below in hexadecimal. We also provide the private key d to help you verify
your encryption result. Be sure to explain how you verified the result.
n = 57F4953D30DBD5BBB1A4CA66F9F8A014D1D77AE33E07A1959C2D6AC4F0C1EDD
e = 24DB1
M = John Doe: Brain MRI -> Clear
d = 04D9C2FF79A74783969D14C8DE260B4B98E98F30A71E92AF2D03432F88047951
Problem 5 [5 points]
Decrypting a Message: The public/private keys used in this problem are the same as the ones used
in Problem 4. Write a C program to decrypt the following ciphertext C.
C = 019D18EA69AB6937E418B8AD5F9A2553B46CFE1A1064F06E4144A8EC67A6B3B0
You will need to convert the result back to a plain ASCII string. The following python command can
be used to convert a hexadecimal string back to a plain ASCII string.
$ python -c ’print("4D7920415343494920737472696E672E".decode("hex"))’
My ASCII string.
Page 11 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
(b) [5 points] Suppose that the signature is corrupted, such that the last byte of the signature changes
from 07 to 08, i.e, there is only one bit of change. Repeat Part (a) of this problem and describe
what happens to the verification process.
Page 12 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021
1 Reminder: Obligations
END OF ASSIGNMENT
Page 13 of 13