0% found this document useful (0 votes)
94 views13 pages

SYSC 4810: Introduction To Network and Software Security Module 2 Assignment

This document outlines an assignment for recommending cryptographic solutions for a medical imaging clinic called MedView Imaging. The clinic needs to encrypt medical images and diagnostic notes transmitted to a central database, and authenticate messages sent between the database and physicians. The assignment involves investigating symmetric and asymmetric encryption techniques, and digital signatures. At the end, a report must be submitted summarizing the findings and recommending specific cryptographic mechanisms, algorithms, key lengths and modes to address MedView Imaging's security and performance needs while ensuring health information privacy compliance.

Uploaded by

Ambar Mendez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views13 pages

SYSC 4810: Introduction To Network and Software Security Module 2 Assignment

This document outlines an assignment for recommending cryptographic solutions for a medical imaging clinic called MedView Imaging. The clinic needs to encrypt medical images and diagnostic notes transmitted to a central database, and authenticate messages sent between the database and physicians. The assignment involves investigating symmetric and asymmetric encryption techniques, and digital signatures. At the end, a report must be submitted summarizing the findings and recommending specific cryptographic mechanisms, algorithms, key lengths and modes to address MedView Imaging's security and performance needs while ensuring health information privacy compliance.

Uploaded by

Ambar Mendez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

SYSC 4810: Introduction to Network and Software Security

Module 2 Assignment
Fall 2021
Dr. J. Jaskolka Posted: September 23, 2021
Carleton University
Department of Systems and Computer Engineering Due: October 10, 2021

Due on Sunday, October 10, 2021 by 11:59PM

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:

1. Do as many problems as you can.

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!

The following items are required for a complete assignment submission:


1. PDF Assignment Report: Submit a detailed report that carefully and concisely describes what
you have done and what you have observed. Include appropriate code snippets and listings, as well
as screenshots of program outputs and results. You also need to provide an adequate explanation of
the observations that are interesting or surprising. You are encouraged to pursue further investigation
beyond what is required by the assignment description.
2. ZIP Archive of Source Code: In addition to embedding source code listings in your assignment
report, create and submit a ZIP archive of all programs that you write for this assignment. Please
name each of your source code files with the problem number to which they correspond (e.g., for
Problem 7(a), the source code file should be named Problem7a.c). Your source code must compile
and run, producing the desired output. Also, please remember to provide sufficient comments in your
code to describe what it does and why.
3. ZIP Archive of Screenshot Image Files: In addition to embedding screenshots of program outputs
and results in your assignment report, create and submit a ZIP archive of all of the raw screenshot
images that you capture for this 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

Part I Assignment Challenge


1 Introduction
Imagine that you are an employee of a computer security consulting firm. Your consulting firm has recently
been approached and contracted by a medical imaging clinic, called MedView Imaging, that cooperates with
local physicians offices and hospitals to provide diagnostic medical imaging services. MedView Imaging has
requested recommendations to help them decide on the specific cryptographic mechanisms to employ in their
new information management systems. You have been assigned as the lead investigator for this contract
and are responsbile for preparing a report to fulfill the contractual obligations of your consulting firm with
MedView Imaging. The details of these contractual obligations are provided in the sections below.
The different parts of this assignment are designed to guide your investigation into the client’s concerns. At
the end of the assignment, you will be required to summarize your findings and provide recommendations
to MedView Imaging addressing their concerns.

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.

Figure 1: MedView Imaging specializes in diagnostic medical imaging.

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

Part II Environment Setup


This assignment will be conducted using a pre-built virtual machine (VM) image. All of the necessary tools,
software, and libraries that are needed for the assignment have been installed on the virtual machine image.
We will assume that you already have a virtual machine set up from the Module 1 Assignment. If you have
not yet completed the Module 1 Assignment, you will need to do so before continuing with this assignment.

*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

Part III Symmetric Cryptography


1 Introduction
The most commonly used symmetric encryption algorithms such as DES, 3DES and AES are block ciphers.
Block ciphers process plaintext input in fixed-size blocks and produce a block of ciphertext of equal size for
each plaintext block. In the case of DES and 3DES, the block length is 64 bits, and for AES the block size
is 128 bits. For longer amounts of plaintext, it is necessary to break the plaintext into blocks (padding the
last block if necessary). To apply a block cipher in a variety of applications, five modes of operation have
been defined and are intended to cover virtually all the possible applications of encryption for which a block
cipher could be used. These modes are intended for use with any symmetric block cipher.
In this part of the assignment, you will becomes familiar with fundamental concepts of symmetric encryption,
including symmetric encryption algorithms and symmetric block cipher modes using openssl.

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.

• plain.txt is the input file to be encrypted


• cipher.txt is the output file containing the ciphertext resulting from the encryption
• key is the key used for encryption (in hexadecimal). Example: 00112233445566778899AABBCCDDEEFF

• initial_vector is the initialization vector to be used (in hexadecimal). Example: 0102030405060708

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

3 Problems and Tasks


Problem 1 [10 points]
Symmetric Encryption using Different Ciphers and Modes: This experiment will enable you to
the behaviour of different ciphers and modes of poperation when using symmetric encryption algorithms.
To complete this problem, do the following:
(a) [1 point] Create a plaintext file: You can populate the file with any contents you would like.
For example, the contents of the file may be: “This is a confidential message intended only for my
friend.” Do not forget to describe the file and its contents in your report.
(b) [4 points] Encrypt the file: Using the openssl enc command, encrypt the file that you created.
Do this using at least THREE (3) different cipher types but use the same key and initialization
vector. Be sure to clearly state the ciphers and the chosen modes that you have selected.
(c) [5 points] Verify the output: Once the files are encrypted, most of the data in the file will not
be printable. To observe the contents of the output file, use the command-line hex viewing tool xxd
as follows:
$ xxd cipher.txt
Explain your findings and clearly identify what you notice about each of the ciphertexts that are
generated.

Problem 2 [10 points]


Encryption Mode: ECB vs. CBC: MedView Imaging needs to store encrypted images from an
imaging service (e.g., CT, X-ray, MRI, etc.) in its central database. The files brain1.bmp and brain2.bmp
each contain a sample MRI image from a brain scan and can be downloaded from the assignment
resources for this assignment on Brightspace. We would like to encrypt these images, so people without
the encryption keys cannot know what is in the image. To complete this problem, do the following:
(a) [2 points] Encrypt the file: Using the openssl enc command as in Problem 1, encrypt
brain1.bmp using the ECB (Electronic Code Book) and CBC (Cipher Block Chaining) modes
using the AES-128 bit cipher.
(b) [1 point] Replace the encrypted headers: We need to treat the encrypted image as an image,
and use an image viewing software to display it. However, for the .bmp file, the first 54 bytes contain
the header information about the image. This header must be set correctly so the encrypted file
can be treated as a legitimate .bmp file. We will replace the header of the encrypted image with
that of the original image. We can use the bless hex editor tool (already installed on the virtual
machine) to directly modify binary files. We can also use the following commands to get the header
from p1.bmp, the data from p2.bmp (from offset 55 to the end of the file), and then combine the
header and data together into a new file as follows:
$ head -c 54 p1.bmp > header
$ tail -c +55 p2.bmp > body
$ cat header body > new.bmp

(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

Part IV Asymmetric Cryptography

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.

2.1 BIGNUM APIs


All of the big number APIs can be found from https://linux.die.net/man/3/bn. In the following, we
describe some of the APIs that are needed for this assignment.
• Some of the library functions require temporary variables. Since dynamic memory allocation to create
BIGNUMs is quite expensive when used in conjunction with repeated subroutine calls, a BN_CTX
structure is created to hold BIGNUM temporary variables used by library functions. We need to create
such a structure, and pass it to the functions that require it.
BN_CTX *ctx = BN_CTX_new();

• Initialize a BIGNUM variable


BIGNUM *a = BN_new();

• There are a number of ways to assign a value to a BIGNUM variable.


// Assign a value from a decimal number string
BN_dec2bn(&a, "12345678901112231223");
// Assign a value from a hex number string
BN_hex2bn(&a, "2A3B4C55FF77889AED3F");

Page 8 of 13
SYSC 4810 — Module 2 Assignment Due Date: October 10, 2021

// Generate a random number of 128 bits


BN_rand(a, 128, 0, 0);
// Generate a random prime number of 128 bits
BN_generate_prime_ex(a, 128, 1, NULL, NULL, NULL);

• Print out a big number.


void printBN(char *msg, BIGNUM * a) {
// Convert the BIGNUM to number string
char * number_str = BN_bn2dec(a);
// Print out the number string
printf("%s %s\n", msg, number_str);
// Free the dynamically allocated memory
OPENSSL_free(number_str);
}

• Compute res = a − b and res = a + b:


BN_sub(res, a, b);
BN_add(res, a, b);

• 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 res = (a × b) mod n:


BN_mod_mul(res, a, b, n, ctx);

• Compute res = ac mod n:


BN_mod_exp(res, a, c, n, 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);

2.2 A Complete Example


The following code sample shows a complete example where we initialize three BIGNUM variables, a, b, and n.
We then compute (a × b) and (ab mod n).
/* bn_sample.c */
#include <stdio.h>
#include <openssl/bn.h>
#define NBITS 256

void printBN(char *msg, BIGNUM * a) {


// Use BN_bn2hex(a) for hex string
// Use BN_bn2dec(a) for decimal string
char * number_str = BN_bn2hex(a);
printf("%s %s\n", msg, number_str);
OPENSSL_free(number_str);
}

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);

// res = a^b mod n


BN_mod_exp(res, a, b, n, ctx);
printBN("a^b mod n = ", res);
return 0;
}

Compilation

We can use the following command to compile bn_sample.c.


$ gcc bn_sample.c -lcrypto

NOTE : the character after - is the letter ℓ, not the number 1; it tells the compiler to use the crypto library.

3 Problems and Tasks

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

Problem 4 [10 points]


Encrypting a Message: Let (e, n) be the public key. Write a C program to encrypt the message
“John Doe: Brain MRI -> Clear” (the quotations are not included). We need to convert this ASCII
string to a hexadecimal string, and then convert the hexadecimal string to a BIGNUM using the hex-to-bn
API BN_hex2bn(). The following python command can be used to convert a plain ASCII string to a
hexadecimal string.
$ python -c ’print("My ASCII string.".encode("hex"))’
4D7920415343494920737472696E672E

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.

Problem 6 [10 points]


Signing a Message: The public/private keys used in this problem are the same as the ones used in
Problem 4.
(a) [5 points] Write a C program to generate a signature for the following message:
M = Ben Rice: Knee MRI -> MCL tear
You should directly sign this message, instead of signing its hash value.
(b) [5 points] Make a slight change to the message M , such as changing ‘MCL’ to ‘LCL’, and sign the
modified message. Compare both signatures and describe what you observe.

Problem 7 [10 points]


Verifying a Signature: Suppose MedView Imaging’s central systems receives a message “Lisa McKay:
Brain CT -> Benign” (the quotations are not included) from a radiologist, with the signature S. We
know that radiologist’s public key is (e, n).
(a) [5 points] Write a C program to verify whether or not the signature is indeed that of the radiologist.
The public key and signature (in hexadecimal) are listed below:
M = Lisa McKay: Brain CT -> Benign
S = 54AAB2D38593EB85BE29B4D084B348F36E8099DDE34A8FE57CE5011F2AF20007
e = A223F
n = BBE2F8AE1FFB0B44C55B9AEB8E55FE300A34590FC19D06485C31563421281819

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

Part V Summary of Findings

1 Reminder: Obligations

You are 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.

2 Problems and Tasks

Problem 8 [10 points]


Recommendations: Write a summary of your recommendations. Write this summary as if you are
going to submit it to MedView Imaging. This means that it should be clear and concise. It should address
all concerns outlined in the contractual obligations above and also take into consideration the client’s
requirements and constraints.
HINT: You may want to refer to specific observations from your experiments obtained in the rest of
the problems in this assignment to justify your recommendations.

END OF ASSIGNMENT

Page 13 of 13

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy