0% found this document useful (0 votes)
358 views

RSA Public-Key Encryption and Signature Lab

1. The document describes tasks performed using RSA public-key cryptography, including deriving the private key from given values of p, q, and e; encrypting and decrypting messages; signing messages with the private key; and verifying signatures. 2. Specific tasks included encrypting the plain text "A top secret!" and decrypting a given ciphertext, signing messages "I owe you $2000" and "I owe you $3000" with the private key, and verifying the signature of "Launch a missile" while tampering with the message to confirm it was detectible. 3. The results of each task are provided, demonstrating successful encryption, decryption, signing, and signature verification when
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
358 views

RSA Public-Key Encryption and Signature Lab

1. The document describes tasks performed using RSA public-key cryptography, including deriving the private key from given values of p, q, and e; encrypting and decrypting messages; signing messages with the private key; and verifying signatures. 2. Specific tasks included encrypting the plain text "A top secret!" and decrypting a given ciphertext, signing messages "I owe you $2000" and "I owe you $3000" with the private key, and verifying the signature of "Launch a missile" while tampering with the message to confirm it was detectible. 3. The results of each task are provided, demonstrating successful encryption, decryption, signing, and signature verification when
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

.

ADDIS ABABA INSTITUTE OF TECHNOLOGY


SCHOOL OF INFORMATION TECHNOLOGY AND
ENGINEERING
Department of Software Engineering

Fundamentals of IT Security
Assignment : RSA (RIvest-Shamir-Adleman)

Group members:

1. Elias Melaku ATR/9508/11


2. Natnael Alemayehu ATR/4785/11

Section - 1

December, 2021

RSA Public-Key Encryption and Signature Lab


Task 1: Deriving the Private Key
We now have initialised the values of p, q, and e from the pdf that was provided by
the seed labs.
We then must find N= p × q
Then ϕ ( N )=( p−1)(q−1)
To calculate the private key we will use the formula d ×e (mod ϕ( N )).

The when this code is compiled it will give us the following private key

So with the given p and q and e values we can generate the following private key

Task 2: Encrypting a Message


Our first task is to change the plain text into a hex. We can do that with python with
the following command.
We now have a hex string of our plain text “A top secret!”.

Then we will initialise our values that is provided to us and encrypt the message

After we ran the code will get the following result

We have now found the encrypted message of the word “A top secret!”.

Task 3: Decrypting a Message

We now have to decrypt the following ciphertext back to it’s ascii form
ciphertext =¿
8 C 0 F 971 DF 2 F 3672 B 28811407E2 DABBE 1 DA 0 FEBBBDFC 7 DCB 67396567 EA 1E2493 F

Since we are told the private/public keys are the same as of the ones from task 2 we
can use them for this section as well

After we compile this code we will get the following output


Now we have found the hex format of the encrypted text. Next we will decrypt the
text into plain ascii format.

To convert it into ascii format we will use python codecs and use it’s decode method
to decode the text.

After decoding this file we will get “Password is dees”.

Task 4: Signing a Message

In this task we are going to sign “I owe you $2000” using our private key.
To sign this text we will use this formula M ❑d mod (n)❑, where M is our message we
want to sign.
We will first change this text into hex format

We will then make this our new M.

After we compile this code we will get

This is the signed cipher text of “I owe you $2000.”

We will now sign “I owe you $3000” and see what the changes are.
As we can see we have got a completely different text even though we only changed
1 character in our signed message.

Task 5: Verifying a Signature

In this task what we are going to do is verify if the message “Launch a missile” is sent
from alice or not.
We are going to use this formula to verify the message S❑e mod (n) where S is the
signature.

When we compile this code we will get.

When we confirm that the message is indeed sent from alice.

Now we will tamper the code a little bit and see if the output changes
When we compile this code we will get.

As we can conclude the message when it is decrypted is not readable suggesting that
this was not actually sent from alice.

You might also like