This shows you the differences between two versions of the page.
ac:laboratoare:04 [2018/10/17 23:49] tiberiu.iorgulescu |
ac:laboratoare:04 [2022/10/27 15:58] (current) marios.choudary |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Lab 04 - Hashes, Public Key Encryption ===== | + | ===== Lab 04 - Public Key Encryption ===== |
- | Before starting the labs, download openssl 1.1.0 from [[https://www.openssl.org/source/openssl-1.1.0c.tar.gz|here]]. | + | Before starting the labs, download openssl 1.1.1 from [[https://www.openssl.org/source/openssl-1.1.1q.tar.gz|here]]. |
Save the file to some local folder accessible by you, then compile it and install it to some folder. | Save the file to some local folder accessible by you, then compile it and install it to some folder. | ||
Open the unpacked folder from bash, and run the following commands: | Open the unpacked folder from bash, and run the following commands: | ||
Line 12: | Line 12: | ||
(in case of trouble, check also the instructions at the end of [[https://ocw.cs.pub.ro/courses/sasc/laboratoare/08|this lab]]). | (in case of trouble, check also the instructions at the end of [[https://ocw.cs.pub.ro/courses/sasc/laboratoare/08|this lab]]). | ||
- | While the tools are building/compiling you may start working on some of the exercises. | + | /* While the tools are building/compiling you may start working on some of the exercises. */ |
+ | <hidden> | ||
==== Exercise 1: Birthday Attack (3p) ==== | ==== Exercise 1: Birthday Attack (3p) ==== | ||
Line 104: | Line 105: | ||
{{:ic:laboratoare:parity_oracle.zip}} | {{:ic:laboratoare:parity_oracle.zip}} | ||
- | ==== Exercise 3: Diffie Hellman (3p) ==== | + | </hidden> |
+ | |||
+ | ==== Exercise 1: Diffie Hellman (8p + 2p) ==== | ||
As we discussed in class, Diffie and Hellman proposed the first public key exchange mechanism such that | As we discussed in class, Diffie and Hellman proposed the first public key exchange mechanism such that | ||
Line 111: | Line 114: | ||
which is usually solved by using TLS/certificates, but we shall not focus on that here). | which is usually solved by using TLS/certificates, but we shall not focus on that here). | ||
- | Download the lab code from {{:ic:laboratoare:lab_dhe.zip|here}}. After unzipping, you'll find the source code | + | Download the lab code from {{:ac:laboratoare:lab_dhe.zip|here}}. After unzipping, you'll find the source code |
for a client (dhe.c) and a server (dhe_server.c), along with a Makefile and fixed Diffie-Hellman p and g params in the files dhparam.pem. | for a client (dhe.c) and a server (dhe_server.c), along with a Makefile and fixed Diffie-Hellman p and g params in the files dhparam.pem. | ||
<note> | <note> | ||
- | Update the Makefile with the paths relevant to your installation folders | + | Update the Makefile with the paths relevant to your installation folders if you didn't use /home/student/local as installation place for openssl. |
</note> | </note> | ||
- | The client and server have a similar structure. Each of them should build a public key, then send it to the other party, receive the public key from the other party and finally compute the secret key. Your task is to complete the missing parts. For this, consult the openssl documentation [[https://www.openssl.org/docs/man1.1.0/crypto/|here]]. Since they are similar, focus only on one of them and then do similarly on the other one. | + | The client and server have a similar structure. Each of them should build a public key, then send it to the other party, receive the public key from the other party and finally compute the secret key. Your task is to complete the missing parts. For this, consult the openssl documentation [[https://www.openssl.org/docs/man1.1.1/man3/|here]]. Since the client and server are similar, focus only on one of them and then do similarly on the other one. |
The makefile should help you build both. Just type 'make all'. | The makefile should help you build both. Just type 'make all'. | ||
Line 125: | Line 128: | ||
If all goes well, you should see the same secret key on both client and server. | If all goes well, you should see the same secret key on both client and server. | ||
+ | |||
+ | <hidden> | ||
+ | The solution is {{:ic:laboratoare:lab_dhe_solved.zip|here}}. | ||
+ | </hidden> | ||
+ | |||
+ | === Bonus 1 === | ||
+ | |||
+ | Perform the DH key exchange between two teams, sending the public key values over the network and verify that you get the same secret key. | ||
+ | |||
+ | === Bonus 2 === | ||
+ | |||
+ | Use the secret key to encrypt some data and check that the other party can decrypt it. You can use | ||
+ | the code available [[https://paste.ubuntu.com/p/4XZpMtt9ZZ/ | here]]. |