This shows you the differences between two versions of the page.
ic:laboratoare:09 [2019/11/23 10:09] george.pirtoaca [Exercise 1] |
ic:laboratoare:09 [2020/11/05 17:54] (current) acosmin.maria |
||
---|---|---|---|
Line 12: | Line 12: | ||
- generate a 16 byte random key; | - generate a 16 byte random key; | ||
- use the key to compute the SHA-1 HMAC of the following message: "Laborator IC"; | - use the key to compute the SHA-1 HMAC of the following message: "Laborator IC"; | ||
- | - use the same key to compute the SHA-1 HMAC of the following message: "Laborator IC!". Notice the difference between the messages - a single character (e.g "!"). Observe that the HMAC is completely different. | + | - use the same key to compute the SHA-1 HMAC of the following message: "Laborator IC!". Notice the difference between the messages - a single character (e.g "!"). Observe that the message authentication codes are completely different. |
Line 49: | Line 49: | ||
</note> | </note> | ||
- | <hidden>The solution is {{:ic:laboratoare:lab9_sol.zip|here}}.</hidden> | ||
==== Exercise 3 ==== | ==== Exercise 3 ==== | ||
- | Before you start solving the exercises below, download the {{:ic:laboratoare:ic_lab10.zip|lab archive from here}}. | + | Before you start solving the exercises below, download the {{:ic:laboratoare:aesgcm.zip|lab archive from here}}. |
The archive contains the source code for Exercise 4, but sadly it is encrypted. Luckily, we forgot to remove the password file from the archive. | The archive contains the source code for Exercise 4, but sadly it is encrypted. Luckily, we forgot to remove the password file from the archive. | ||
Line 63: | Line 62: | ||
The file is encrypted using AES-256 in CBC mode. | The file is encrypted using AES-256 in CBC mode. | ||
</note> | </note> | ||
- | |||
==== Exercise 4 ==== | ==== Exercise 4 ==== | ||
+ | |||
+ | <hidden> | ||
+ | |||
+ | <note hint> | ||
+ | The problem has been fixed, so no more code for students! | ||
+ | </note> | ||
In case you didn't manage to solve Exercise 3 (more recent versions of openssl are not compatible with respect to the encryption/decryption using password), here is the lab starting code: | In case you didn't manage to solve Exercise 3 (more recent versions of openssl are not compatible with respect to the encryption/decryption using password), here is the lab starting code: | ||
Line 171: | Line 175: | ||
} | } | ||
</code> | </code> | ||
+ | |||
+ | </hidden> | ||
In this exercise we'll use OpenSSL to encrypt and decrypt with AES-128-GCM. Unfortunately, AES-GCM is not supported by the command line utilities of OpenSSL so we'll have to implement it ourselves. | In this exercise we'll use OpenSSL to encrypt and decrypt with AES-128-GCM. Unfortunately, AES-GCM is not supported by the command line utilities of OpenSSL so we'll have to implement it ourselves. | ||
Line 230: | Line 236: | ||
See the open ssl manual [[https://www.openssl.org/docs/man1.1.0/crypto/EVP_aes_256_gcm.html|here]] page for EVP encrypt to see the usage of the EVP functions and an example similar to the one above. | See the open ssl manual [[https://www.openssl.org/docs/man1.1.0/crypto/EVP_aes_256_gcm.html|here]] page for EVP encrypt to see the usage of the EVP functions and an example similar to the one above. | ||
</note> | </note> | ||
- | |||
- | <hidden> | ||
- | The solution is {{:ic:laboratoare:lab10_sol.zip|here}}. | ||
- | |||
- | Alternative solution: [[https://paste.ubuntu.com/p/4XZpMtt9ZZ/|Source code]] | ||
- | </hidden> |