This is the archived website of SI 486H from the Spring 2016 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.

Problem 87

Run a garbled circuit using openssl

Due: April 19
Points: 2

The circuit

The image below shows you Bob's view of a garbled circuit, where you see the encrypted gates, all the wires, and how they're connected. Note that Bob doesn't actually know the operation of each gate, just how to evaluate them if he has a value for each input wire.

And here are the encrypted truth tables for each gate.

GATE 1:
U2FsdGVkX18x6HrPnqpxMQhH4OGShe0FuUuKYqfe+2lsg9DpDKVXxQ==
U2FsdGVkX19ugkBN9qtVwrDiFpZ+DrYzFAzXexr74EYkEDVO0JP+/A==
U2FsdGVkX1+BtqeD//Ac4qvoCuqR4CL3Qk+5iw1hWpuU4FEBA5eROg==
U2FsdGVkX1+U/uXleqXdU0tQWfeDyII88/fNdoNpOeB3EaNtQKz/RQ==

GATE 2:
U2FsdGVkX18T72oQtxvf7jYvTFKjVlxLXrU82QjQI0tcS9dDC5zPpg==
U2FsdGVkX18TdCOrW61HCK2ZhLdZGSWr5m4Fd1CEVing209PNddmrw==
U2FsdGVkX19MEC5vW9afnwa8tro01pSTi/TjzGAeE5EDfYdae+yVuQ==
U2FsdGVkX1+Shm7wF5mOKYipo+eFnMgU/+ZrJPqWJ9Nvva1+6MRV7w==

GATE 3:
U2FsdGVkX19gbJ4mWeuRPR8UN9+1g7ZteGOOY3U3rBss+ih3sB9LmA==
U2FsdGVkX1+gQ1Y++dYTc33OamQBcBw70taX0U17pyLfz5p38otpOg==
U2FsdGVkX1/hnqu2SebiC46dhCHGxAYhawPZn8t53Q3ti7kfh4QecQ==
U2FsdGVkX1+r2s64LSOJpRSwhYjDNu0wNaU3n+PBN2LBxSpbmzFTxA==

Encryption and decryption

For this problem, you are going to use the openssl command-line utility (which is installed on all the lab machines and generally can be found on any typical Linux installation) for the encryption and decryption. Specifically, you are going to use the "blowfish" symmetric cipher and base64 encoding of ciphertexts. All valid wire values will be 6-digit numbers.

To perform the double-encryption of each truth table entry, I used the following command:

echo "OUTPUT_WIRE" | openssl bf -k INPUT_WIRE_2 | openssl bf -nopad -k INPUT_WIRE_1 -a

where OUTPUT_WIRE is the output value getting encrypted, and INPUT_WIRE_1 and INPUT_WIRE_2 are the input wire values. Remember that each wire value is a 6-digit number that either means true or false (but only Alice knows which is which).

(Note: the bf command means to use the blowfish cipher, -k is for inputting the encryption key on the command line, nopad says not to add any extra padding on the second encryption, and -a says to print the output in base64 encoding so you don't have to deal with funky characters on the command line.)

To reverse this process, you would do something like

echo "CIPHERTEXT" | openssl bf -d -k INPUT_WIRE_1 -nopad -a | openssl bf -d -k INPUT_WIRE_2

The result will either be the correct output wire value, or you'll get some error like "bad magic number" or "bad decrypt" indicating that it didn't work. Remember, with garbled circuits, exactly ONE of the decryptions will work and the rest will not.

Wire values

You each have some different input wire values to use in order to perform the computation. They have been emailed out to you. If you have any questions, ask Dr. Roche.

Your task

Simple: Just run the garbled circuit on your emailed wire values. Give me the values of both intermediate wires (\(w_5\) and \(w_6\)) as well as the output from the entire circuit (which will be either 0 or 1).