Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 1 Understanding Public Key Encryption Preparation: Review textbook explanation on public key encryption, understanding this encryption method needs each user to have a pair

Lab 1 Understanding Public Key Encryption

Preparation:

Review textbook explanation on public key encryption, understanding this encryption method needs each user to have a pair of two keys (public key and private key). This key pair can serve for your encryption needs (others use key owners public key to encrypt message, the owner could use private key to decrypt it) or digital signature needs (owner use his private key for signature, others use owners public key to verify it).

Make sure your computer have installed Office 365, which is available for all UHV students for free.

Lab instruction:

  1. Download the excel file (contains three worksheets) to a local folder. This excel file contains three worksheets. The first worksheet allows one to choose two small primes and a public key. The worksheet computes the associated private key. (Note: in reality, the two prime numbers should be large enough to deter hacking attempt.) The second worksheet allows user A to encrypt a short message (up to 15 capital letters) intended for user B by using user Bs public key. The third worksheet allows user A to decrypt a message received from user B and the cipher text is generated by using user As public key.

  1. Open the spreadsheet (rsa.xls) you downloaded. You may see a warning message informing you that the workbook contains macros. Since you will not need these macros to use this workbook, click on the Disable Macros button.
  2. If necessary, click on the tab for the Key Selection worksheet. Use a random process to choose two different prime numbers p and q between 137 and 311 (displayed in a list in cells g5:I15). Enter these primes in cells B6 and B7. Be sure that cells C6 and C7 both display the message OK. The spreadsheet automatically computes the modulus (the product p*q) in cell B8 and the Euler totient (the product (p-1)*(q-1)) in cell B9. Note that the Euler totient would be difficult to determine from the modulus by itself; one needs to know the two primes. Write your two primes, your modulus, and your Euler totient below: p: __167_____ q: _139__________ modulus: _23213__________ Euler totient: ____22908__________

  1. Choose a small number (no more that two digits) that has no factors (except 1) in common with the Euler totient. Enter this number as your public key and enter it in cell B15. If cell C15 displays the message Invalid Public Key, you need to select a different public key. When you have chosen a valid public key, the message OK will appear in cell C15. The spreadsheet will automatically compute your private key in cell B20. The private key is chosen so that (Public Key)*(Private Key) leaves a remainder of one when divided by the Euler totient. (This would not be possible if the private had a factor other than 1 in common with the Euler totient.) Write your public and private keys below: Public key: ____13_________ Private key: ___10573____________
  2. Once both you and your partner have each created a modulus and pair of keys, you are ready to exchange encrypted messages. Give your modulus and public key to your partner. Do not give your partner your private key or Euler totient. In return, your partner will give you her/his public key and modulus.
  3. Click on the tab for the Encoding worksheet. Enter your partners modulus and public key in cells B6 and B7. You need your partners public key to encrypt the message you plan to send him in the next step. Write these values below: Partners modulus: ___47077______________ Partners public key: ___17_______________
  4. Enter a message in cell B11. This message should consist of a string of fifteen or more capital letters with no spaces or punctuation marks. The spreadsheet will encipher only the first fifteen letters of your message. Your message could be a short phrase or sentence, your mothers name or your pet iguanas name. For example, I used ABCDEFGHIJKLMNOP and PLEASEHELPMENOW to test this spreadsheet. Note that a message to be enciphered is usually called plaintext. The enciphered form of the message is called the ciphertext.

The enciphered form of the message (the ciphertext) should appear in cell B13. (This may take a few seconds.) The spreadsheet determines the ciphertext as follows:

  • Split the plaintext up into blocks of three letters (called trigraphs).
  • Obtain a numeric representation for each letter based on its position in the alphabet (A0, b1, etc.).
  • Compute a numeric code for each trigraph using the formula (First Letter Code) * 262 + (Second Letter Code) * 26 + (Third Letter code). For the mathematically inclined, this is interpreting each trigraph as a number in base twenty-six.
  • Encipher each plaintext trigraph code by computing (Plaintext trigraph code)Public Key, dividing the result by the Modulus and taking the remainder.
  • Convert each enciphered trigraph code into a quadragraph a block of four letters as follows:
  • Divide the code by 263. The quotient is the code for the first letter of the quadragraph. The spreadsheet uses the remainder to get codes for the other three letters.
  • Divide the remainder from the first step by 262. The quotient is the code for the second letter. The spreadsheet uses the remainder to get the codes for the other two letters.
  • Divide the remainder from the second step by 26. The quotient is the code for the third letter and the remainder is the code for the fourth letter. For the mathematically inclined, this quadragraph calculation determines the representation of the enciphered message as a four-digit number in base twenty-six (using the letters of the alphabet as our digits).

Some of the details of this calculation appear in cells A16:K38 of the Encoding worksheet. Enter the plaintext and ciphertext below. Show the steps of the conversion process in the table. Plaintext: _____________________________________

Plaintext

Ciphertext

Trigraph

Trigraph Code

Enciphered Code

Quadragraph

Ciphertext: ___________________________________

  1. Give the ciphertext (but not the plaintext) to your partner. In return, your partner will give you a ciphertext message. Record the ciphertext message from your partner below. In the rest of this exercise, you will be deciphering this message. Ciphertext from partner: ______________________________
  2. Click on the tab for the Decoding worksheet. Enter your modulus and your private key in cells B6 and B7 of this worksheet. Enter the ciphertext you received from your partner as the Encrypted Message in cell B13. The deciphering process is similar to the enciphering process:

  • Split the ciphertext up into quadragraphs (instead of trigraphs).
  • Obtain the numeric representation for each letter and compute a numeric code for each trigraph using the formula (First Letter Code) * 263 + (Second Letter Code) * 262 + (Third Letter Code) * 26 + (Fourth Letter Code). Encipher each ciphertext quadragraph code by computing (Ciphertext quadragraph code)Private Key, dividing the result by the Modulus and taking the remainder
  • Convert each deciphered quadragraph code into a trigraph.
  • Divide the code by 262. The quotient is the code for the first letter.
  • Divide the remainder from the first step by 26. The quotient will be the code for the second letter and the remainder the code for the third.

Note that deciphering uses the private key in place of the public key. Some of the details of this calculation appear in cells A19:D23 of the Decoding Worksheet. The deciphered message should appear in cell B13. Record the results of each deciphering step in the table below.

Ciphertext

Plaintext

Quadragraph

Quadragraph Code

Deciphered Code

Deciphered Trigraph

Now, write the deciphered message (plaintext) below. Deciphered message: __________________________

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions