Table of contents
Open Table of contents
What it is
A Proxy Re-Encryption scheme allows for the modification of a ciphertext that was encrypted under key A to be decryptable with a different key B. This ciphertext modification can be done by any untrusted third party as it won’t learn anything about the underlying plaintext or the private keys involved.
How it works
Note: The Proxy Re-Encryption scheme presented here is a simplified version of a variant that uses the Diffie-Hellman Key Exchange protocol. It’s discussed here for educational purposes only and shouldn’t be used in a production environment.
In our example we have four different parties we call Alice, Bob, Charlie and Dave:
- Alice receives an encrypted message from Charlie and wants Bob to be able to decrypt that message as well
- Bob who relies on Dave, the untrusted third Party, to be able to decrypt Alice’s message
- Charlie who sends a message to Alice encrypted under her public key
- Dave, the untrusted third party who acts as a proxy to allow Bob to decrypt Alice’s message without learning anything about the message or the private keys involved
In this writeup we’ll be working with an Elliptic Curve that is of order and has a generator . All calculations are done if not stated otherwise.
As a first step, Alice, Bob and Charlie generate their private- and public keys.
Alice does this by sampling a random value from which serves as her private key .
This value is then multiplied by the generator to calculate her public key .
Bob follows the exact same steps and starts the key generation procedure by sampling a random value from which is interpreted as his private key .
His private key is then multiplied by to derive the corresponding public key .
The exact same steps are followed by Charlie who generates his private key by sampling a random value from .
He then also multiplies this private key by to calculate his public key .
Given that Charlie wants to send a message to Alice he needs to get access to her public key , so both Alice and Charlie do a key exchange of their public keys and .
As Alice wants Bob to be able to decrypt her message she’ll receive from Charlie, she needs to get access to Bob’s public key to generate a re-encryption key for Bob. Both of them therefore also do a key exchange of their public keys and .
Charlie is now able to send Alice a message that’s encrypted under her public key .
To do that, he generates a shared secret following the regular Elliptic Curve Diffie-Hellman protocol by multiplying his private key with Alice’s public key .
This shared secret can then be used to “blind” the plaintext message Charlie wants to send to Alice. The “blinding” is a simple multiplication of by which results in the ciphertext .
Charlie sends this ciphertext to Alice.
Given that Alice wants Bob to be able to read the plaintext message of , she can use Bob’s public key to calculate a re-encryption key that can be used by Dave, the untrusted third party to create a decryption key for Bob which he can use to decrypt Alice’s message with his own private key .
Alice calculates by dividing her private key by a Hash of the multiplication of Bob’s public key with her private key. The Hash is computed via a cryptographic hash function .
Notice that the multiplication of Bob’s public key with Alice’s private key is another instance of the regular Elliptic Curve Diffie-Hellman protocol in which Alice and Bob can use their public- and private keys to derive a shared secret only both of them have access to. We’ll see a similar computation later on when Bob derives the same shared secret by multiplying Alice’s public key with his private key .
This re-encryption key can be publicly shared. Alice send the re-encryption key as well as Charlie’s public key to the untrusted third-party Dave.
Using this information, Dave creates a decryption key for Bob that allows Bob to later decrypt Alice’s ciphertext . The decryption key is calculated by multiplying Charlie’s public key with the re-encryption key .
Notice that Dave learns nothing about Alice’s, Bob’s or Charlie’s private keys as he’s only working with the publicly shareable re-encryption key as well as Charlie’s public key . In addition to that, he also doesn’t learn anything about the plaintext message .
Dave can now send this decryption key to Bob who can use it to decrypt Alice’s ciphertext .
In our case, we assume that Alice forwarded to Bob, but it doesn’t really matter who sends to Bob as it’s a ciphertext which can be kept by different entities. The only important part is that it’s the correct Bob get’s access to.
Now that Bob got his decryption key from Dave which itself is based on the re-encryption key Alice calculated, he can decrypt the message Charlie sent to Alice using and his own private key .
To do so, Bob first recomputes the blinding factor by multiplying with a hash of a multiplication of his private key by Alice’s public key . The Hash is computed via a cryptographic hash function .
Again, notice that the multiplication of Alice’s public key with Bob’s private key is an instance of the regular Elliptic Curve Diffie-Hellman protocol. Bob therefore derives the same shared secret Alice also computed in a prior step.
Bob can then use to recover the plaintext message . To do so, he divides the ciphertext by .
Why it works
The first thing to note is that the message that Charlie initially sent to Alice is “blinded” by the value which is a shared secret that both Alice and Charlie can calculate following the regular Elliptic Curve Diffie-Hellman protocol. Due to the usage of this “blinding” factor, the resulting ciphertext looks like random noise and thanks to the “hardness” assumption of the discrete logarithm, it’s impossible to recover from and therefore learn anything about .
The re-encryption key that Alice calculates also uses a shared secret that both Alice and Bob can calculate. This shared secret is hashed with a cryptographic hash function and serves as the denominator in the equation of .
Given that Bob also has Alice’s public key, he’s able to recompute the denominator of himself using his private key to derive the same shared secret and hashing it with the same cryptographic hash function .
Bob can now recompute the blinding factor himself as his decryption key is just a multiplication of with Charlie’s public key . He can use to “isolate” a multiplication of Alice’s private key by Charlie’s private key multiplied by the generator .
Note that this is the exact that Charlie used to “blind” his message he sent to Alice.
Given that Bob has now access to he can recover the plaintext by dividing by .
To show that this is indeed a message originally intended for Alice, we can show that Alice can recover as well. To do that she calculates by multiplying her private key with Charlie’s public key . As a reminder, this is just the regular Elliptic Curve Diffie-Hellman protocol to derive a shared secret.
She’s then also able to use this (which is the same that Bob was able to calculate) to recover by dividing the ciphertext by .
References
The following resources have been invaluable for me to learn the concepts discussed in this article.
You should definitely give them a read if you want to dive deeper into the topic.