This shows you the differences between two versions of the page.
ac:laboratoare:08 [2024/11/14 11:27] dimitrie.valu |
ac:laboratoare:08 [2024/11/14 13:05] (current) dimitrie.valu |
||
---|---|---|---|
Line 1: | Line 1: | ||
===== Lab 08 - Whatsapp End-to-end Encryption (part 2) ===== | ===== Lab 08 - Whatsapp End-to-end Encryption (part 2) ===== | ||
- | In this lab you will continue the implementation of the Signal protocol, which is the basis for WhatsApp's end-to-end encryption. | + | In this lab you will continue the implementation of the Signal Protocol, which is the basis for WhatsApp's end-to-end encryption. |
The protocol is described [[https://cryptome.org/2016/04/whatsapp-crypto.pdf|here]]. | The protocol is described [[https://cryptome.org/2016/04/whatsapp-crypto.pdf|here]]. | ||
Line 8: | Line 8: | ||
For the Elliptic Curves, you can use [[https://github.com/Muterra/donna25519|this]] library. | For the Elliptic Curves, you can use [[https://github.com/Muterra/donna25519|this]] library. | ||
- | For installation, follow these steps: | + | If you solved the previous lab, use your previous setup (replace the files with the ones from the ''%%.zip%%'' below to prevent any issues). If you are starting out with these labs, follow the steps below (NOTE: **you can use your ''%%fep%%'' instance via Python3 environments**): |
- | * Log-in as admin (need admin user/password from lab host) | + | * Install the necessary tools (not necessary on ''%%fep%%''): |
- | * Select Administration->Software Sources and then select the romanian repos for high bandwidth | + | <code> |
- | * Install the necessary tools: sudo apt-get install build-essential setuptools python-dev | + | sudo apt install build-essential python3-dev |
- | * Install pip: sudo apt-get install pip | + | sudo apt install python3-pip |
- | * Install donna via pip: sudo pip install donna25519 | + | </code> |
- | * Log-out from admin account | + | * Use ''%%wget%%'' to download the required zip (find it below) |
- | * Log-in with student as usual | + | * Create a Python3 environment, make sure PyPI is up to date and install the required packages: |
+ | <code> | ||
+ | python3 -m venv create env | ||
+ | source ./env/bin/activate | ||
+ | pip install --upgrade pip | ||
+ | pip install cryptography donna25519 | ||
+ | </code> | ||
+ | **If local installation does not work, use your ''%%fep%%'' instance.** | ||
- | === Task 1 (Vertical & Horizontal ratcheting) === | ||
- | See the previous lab for how to create a common master_secret for two clients which communicate through a server. | + | === Task - Vertical & Horizontal ratcheting === |
+ | |||
+ | See the previous lab for how to create a common ''%%master_secret%%'' for two clients which communicate through a server. | ||
Then, send messages with different keys each time, by recalculating the Chain Key according to the Signal Protocol. | Then, send messages with different keys each time, by recalculating the Chain Key according to the Signal Protocol. | ||
Line 44: | Line 52: | ||
while chain_key_r can be left as 'None' for now. | while chain_key_r can be left as 'None' for now. | ||
</note> | </note> | ||
+ | |||
+ | == How to run == | ||
+ | Open three different terminals. | ||
+ | |||
+ | First terminal (start the server): | ||
+ | <code>python main_server.py</code> | ||
+ | |||
+ | Second terminal (start the first client and enter ''%%RECV%%'' mode: | ||
+ | <code> | ||
+ | python main_client.py | ||
+ | RECV | ||
+ | </code> | ||
+ | |||
+ | Third terminal (start the second client and send a message): | ||
+ | <code> | ||
+ | python main_client.py | ||
+ | MSG <id_other_client> Hello! | ||
+ | </code> |