Table of contents
Open Table of contents
What it is
An Oblivious Transfer allows a sender to send one of many different messages to a receiver so that the receiver doesn’t know which one of the messages the sender decided to send.
As an example, let’s assume that Alice has two messages and and Bob flips a coin that has value or . Once Bob decides on flipping the coin to get value , Alice should send without her learning or Bob learning which Alice sent
How it works
The following Oblivious Transfer protocol is based on the Elliptic Curve Diffie-Hellman protocol which is worthwhile to revisit before continuing.
Throughout this writeup We’ll be using an Elliptic Curve that is of order and has a generator . All calculations are done if not stated otherwise.
In our setup Alice acts as the sender who wants to ensure that Bob, the receiver gets access to only one of two messages and without learning which one he got access to.
As a first step, Alice generates her private key by sampling a random value from :
She then derives her public key by multiplying with the generator :
This public key is then shared with Bob.
Bob will now toss a fair coin which results in an outcome that’s either or for “Heads” and “Tails” respectively:
He also generates his private key by sampling a random value from :
Based on the outcome of he does one of two things:
- If he sets his public key to which is him following the regular Elliptic Curve Diffie-Hellman protocol.
- If he sets to which is him adding Alice’s public key to his derived his “masked” public key.
Once done, Bob sends the resulting to Alice. Note that in either case ( being or ) Alice can’t determine whether Bob sent her the masked or unmasked .
When Alice receives she computes two values and as follows:
- which is her following the regular Elliptic Curve Diffie-Hellman protocol.
Alice then continues by encrypting the two messages and with and respectively to get the two ciphertexts and :
Those two ciphertexts are then sent to Bob.
Bob will now compute the shared secret by multiplying his private key with Alice’s public key :
Bob now attempts to decrypt both ciphertexts and with of which only one decryption will be successful. This in turn allows him to access the message .
Why it works
First, it’s important to note that Bob generating two potential values for (one of which might be a value that’s masked via Alice’s public key ) won’t allow Alice to determine which version of she got, since both will look like a random value to her.
Next, Bob will only be able to decrypt one of the two ciphertexts or but he doesn’t know which is which.
Only one decryption will work because as outlined in the following equations.
As one can see, only one of the two keys resolves to the shared secret Bob is also able to compute via . The other key includes the term or which won’t allow for a correct decryption because Bob doesn’t know .