Exercises7.8Sage Exercises

1.

Construct a keypair for Alice using the first two primes greater than $$10^{12}\text{.}$$ For your choice of $$E\text{,}$$ use a single prime number and use the smallest possible choice.

Output the values of $$n\text{,}$$ $$E\text{,}$$ and $$D$$ for Alice. Then use Sage commands to verify that Alice's encryption and decryption keys are multiplicative inverses.

2.

Construct a keypair for Bob using the first two primes greater than $$2\cdot 10^{12}\text{.}$$ For your choice of $$E\text{,}$$ use a single prime number and use the smallest possible choice. Output the values of $$n\text{,}$$ $$E\text{,}$$ and $$D$$ for Alice.

Encode the word Math using ASCII values in the same manner as described in this section (keep the capitalization as shown). Create a signed message of this word for communication from Alice to Bob. Output the three integers: the message, the signed message and the signed, encrypted message.

3.

Demonstrate how Bob converts the message received from Alice back into the word Math. Output the value of the intermediate computations and the final human-readable message.

4.

Create a new signed message from Alice to Bob. Simulate the message being tampered with by adding $$1$$ to the integer Bob receives, before he decrypts it. What result does Bob get for the letters of the message when he decrypts and unsigns the tampered message?

5.Classroom Exercise.

Organize a class into several small groups. Have each group construct key pairs with some minimum size (digits in $$n$$). Each group should keep their private key to themselves, but make their public key available to everybody in the room. It could be written on the board (error-prone) or maybe pasted in a public site like pastebin.com. Then each group can send a signed message to another group, where the groups could be arranged logically in a circular fashion for this purpose. Of course, messages should be posted publicly as well. Expect a success rate somewhere between 50% and 100%.

If you do not do this in class, grab a study buddy and send each other messages in the same manner. Expect a success rate of 0%, 50% or 100%.