Plaintext space check #10

Merged
pdyraga merged 3 commits from master into master 2018-08-07 20:43:36 -04:00
pdyraga commented 2018-08-02 09:38:47 -04:00 (Migrated from github.com)

According to [DJN 10], the plaintext space is Z_n. We had this information in the Encrypt and EncryptWithR documentation but sometimes, when encrypting result of more complex equations, it's easy to miss the fact their result is out of the allowed range.

Here we have just a safety check making sure that if plaintext is out of the allowed space, we report an error.

To better illustrate why it does not make sense to allow encrypting values out of Z_n, let's use a simple example for n = 143:

m = -141 -> D(E(m)) = 0
m = -142 -> D(E(m)) = 0
m = -143,  -> D(E(m)) = 0
m = -144 -> D(E(m)) = 0
m = -145 -> D(E(m)) = 0

we can't restore the original value of m.

Now for positive integers:

m = 141 -> D(E(m)) = 141
m = 142 -> D(E(m)) = 142
m = 143 -> D(E(m)) = 0
m = 144 -> D(E(m)) = 1
m  = 145 -> D(E(m)) = 2

We can restore the original message for m < n (143) but for m > 143 we can't really go back to the original value. If we allow for any positive m, D(E(m)) = 1 means that m is either 1 or it's m = nk + 1 for any positive k. Since we can't restore the original message unambiguously, allowing for m >=n does not make sense.

[DJN 10]: Ivan Damgard, Mads Jurik, Jesper Buus Nielsen, (2010)
A Generalization of Paillier’s Public-Key System
with Applications to Electronic Voting
Aarhus University, Dept. of Computer Science, BRICS

According to [DJN 10], the plaintext space is `Z_n`. We had this information in the `Encrypt` and `EncryptWithR` documentation but sometimes, when encrypting result of more complex equations, it's easy to miss the fact their result is out of the allowed range. Here we have just a safety check making sure that if plaintext is out of the allowed space, we report an error. To better illustrate why it does not make sense to allow encrypting values out of `Z_n`, let's use a simple example for `n = 143`: ``` m = -141 -> D(E(m)) = 0 m = -142 -> D(E(m)) = 0 m = -143, -> D(E(m)) = 0 m = -144 -> D(E(m)) = 0 m = -145 -> D(E(m)) = 0 ``` we can't restore the original value of `m`. Now for positive integers: ``` m = 141 -> D(E(m)) = 141 m = 142 -> D(E(m)) = 142 m = 143 -> D(E(m)) = 0 m = 144 -> D(E(m)) = 1 m = 145 -> D(E(m)) = 2 ``` We can restore the original message for `m < n (143)` but for `m > 143` we can't really go back to the original value. If we allow for any positive `m`, `D(E(m)) = 1` means that `m` is either `1` or it's `m = nk + 1` for any positive `k`. Since we can't restore the original message unambiguously, allowing for `m >=n` does not make sense. [DJN 10]: Ivan Damgard, Mads Jurik, Jesper Buus Nielsen, (2010) A Generalization of Paillier’s Public-Key System with Applications to Electronic Voting Aarhus University, Dept. of Computer Science, BRICS
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: didier/paillier#10