|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpaillierp.AbstractPaillier
paillierp.PaillierThreshold
public class PaillierThreshold
A simple implementation of the threshold Paillier encryption scheme CS1. This is based on the scheme given in Generalization of Paillier's Public-Key System with Applications to Electronic Voting by Damgård et al. with the parameter s fixed at 1.
With most of the methods already defined in AbstractPaillier
, this
class provides the essential methods of encryption and decryption in the
threshold Paillier encryption scheme, as well as a few test/diagnostic
methods.
The Math: The threshold Paillier encryption scheme takes a
PaillierKey
n to encrypt a plaintext
i in Zns by choosing a random
r∈Zn* by simply computing
(n+1)irn mod ns+1.
If decryption server i is given a
PaillierPrivateThresholdKey
si, raising a ciphertext c to the power
2Δsi (where Δ=l!)to produce a partial
decryption ci. Working with at least w-1 other
decryption servers, each obtains a list of at least w partial
decryptions. By raising partial decryption ci to the
exponent 2λ0,i then multiplying each ciphertext
together, we arrive at the value
c'=c4Δ2d. This is possible because
the key generation used a polynomial f of degree w where
f(0) = d. By using the Lagrange method for interpolating
values of a polynomial, we need at least w points to find d.
Using the method devised
in the paper, we can use c'get the original message
m mod ns.
Note that the value d is kept secret in the decryption of any message.
Only when one has w secret keys si can one construct
a method to find d. Otherwise, during the decryption process, d
is hidden as an exponent. Note also that the random number
generator is included in the key object. (The default is
SecureRandom
.)
Future expansions will include support for encrypting arbitrary length strings/byte arrays to avoid padding issues, and support for padding.
AbstractPaillier
Field Summary | |
---|---|
protected PaillierPrivateThresholdKey |
deckey
Private Key allowing decryption; should be same as public key. |
Fields inherited from class paillierp.AbstractPaillier |
---|
decryptMode, encryptMode, key, notReadyForDecryption, notReadyForEncryption |
Constructor Summary | |
---|---|
PaillierThreshold()
Default constructor. |
|
PaillierThreshold(PaillierKey key)
Constructs a new encryption object which uses the specified key for encryption. |
|
PaillierThreshold(PaillierPrivateThresholdKey key)
Constructs a new encryption/decryption object which uses the specified key for both encryption and decryption. |
|
PaillierThreshold(PaillierThresholdKey key)
Constructs a new encryption object which uses the specified key for encryption. |
Method Summary | |
---|---|
java.math.BigInteger |
combineShares(DecryptionZKP... shares)
This function combines the shares of the decryption to get the final decryption, all the while checking to make sure that each ZKP proves a good partial decryption of the correct ciphertext. |
java.math.BigInteger |
combineShares(PartialDecryption... shares)
This function combines the shares of the decryption to get the final decryption, assumes that the shares are valid. |
PartialDecryption |
decrypt(java.math.BigInteger c)
Partially decrypts the given ciphertext c < n2
using the share of the private key. |
java.math.BigInteger |
decryptOnly(java.math.BigInteger c)
Partially decrypts the given ciphertext c < n2
using the share of the private key. |
DecryptionZKP |
decryptProof(java.math.BigInteger c)
Partially decrypts the given ciphertext c < n2
using the share of the private key. |
PaillierPrivateThresholdKey |
getPrivateKey()
The private key for the Paillier system with thresholding is the RSA modulo n and the secret share si |
PaillierThresholdKey |
getPublicThresholdKey()
The public key of the Paillier threshold system, which includes the values n and the public values v and {vi}. |
void |
setDecryptEncrypt(PaillierPrivateThresholdKey key)
Sets the mode for this object to decrypt and encrypt using the provided key. |
(package private) void |
setDecryption(PaillierPrivateThresholdKey key)
Sets the mode for this object to decrypt and will use the provided key to decrypt only. |
(package private) void |
setEncryption(PaillierKey key)
Sets the mode for this object to encrypt and will use the provided key to encrypt messages. |
(package private) void |
setEncryption(PaillierThresholdKey key)
Sets the mode for this object to encrypt and will use the provided key to encrypt messages. |
Methods inherited from class paillierp.AbstractPaillier |
---|
add, add, encrypt, encrypt, encrypt, encrypt, encrypt, encryptone, encryptProof, encryptzero, getPublicKey, multiply, multiply, multiply, multiplyProof, randomize, randomize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PaillierPrivateThresholdKey deckey
Constructor Detail |
---|
public PaillierThreshold()
public PaillierThreshold(PaillierThresholdKey key)
key
- Public key used for encryptionpublic PaillierThreshold(PaillierPrivateThresholdKey key)
key
- Private key used for decryption and encryptionpublic PaillierThreshold(PaillierKey key)
key
- Public key used for encryptionMethod Detail |
---|
void setEncryption(PaillierKey key)
key
- Public key which this class will use to encryptvoid setEncryption(PaillierThresholdKey key)
key
- Public key which this class will use to encryptvoid setDecryption(PaillierPrivateThresholdKey key)
setEncryption(PaillierKey)
.)
key
- Private key which this class will use to decryptpublic void setDecryptEncrypt(PaillierPrivateThresholdKey key)
key
- Private key which this class will use to encrypt and decryptpublic PaillierThresholdKey getPublicThresholdKey()
public PaillierPrivateThresholdKey getPrivateKey()
public java.math.BigInteger decryptOnly(java.math.BigInteger c)
c
< n2
using the share of the private key. Returns only the decrypted value
with no ID attached.
c
- ciphertext as BigInteger
public PartialDecryption decrypt(java.math.BigInteger c)
c
< n2
using the share of the private key.
c
- ciphertext as BigInteger
public DecryptionZKP decryptProof(java.math.BigInteger c)
c
< n2
using the share of the private key. This then gives a non-interactive
Zero Knowledge Proof that the partial decryption is truly this share's
contribution to the decryption of c
.
c
- ciphertext as BigInteger
public java.math.BigInteger combineShares(PartialDecryption... shares)
shares
- a collection of at least w partial decryptions
of the same ciphertext
public java.math.BigInteger combineShares(DecryptionZKP... shares)
shares
- a collection of at least w partial decryptions
(with ZKP) of the same ciphertext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |