- Set Up
- Files
- Create your public and private key
- Cipher a message with the session key
- Decipher a message with the session key
- Running the tests
$ pip install virtualenv
$ python -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
The assignment specifies that the following files must be submitted:
- pubB.asc (it's inside data/pubB.asc)
- ciphertext.b64 (it's inside data/ciphertext.b64)
For generating a public and private key, execute the following command:
$ python create_keys.py
The public key will be saved on public_key.asc, and the private key will be saved on private_key.asc
The session key is generated from:
- Your private key (which in the cryptography library needs your public key for recreating the DHPrivateKey object).
- The other entity public key.
Knowing this, execute:
$ python cipher.py
The session key is generated from:
- Your private key (which in the cryptography library needs your public key for recreating the DHPrivateKey object).
- The other entity public key.
Knowing this, execute:
$ python decipher.py
I've made one test that does the following:
- Generates private and public keys for A
- Generates private and public keys for B
- Ciphers a message from A and saves it to a file.
- B deciphers the message from A.
- Assert that the message is the same.
For running this test execute:
$ ./test/run.sh