paillierp.key
Class PaillierThresholdKey

java.lang.Object
  extended by paillierp.key.PaillierKey
      extended by paillierp.key.PaillierThresholdKey
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
PaillierPrivateThresholdKey

public class PaillierThresholdKey
extends PaillierKey

A public key for the threshold Paillier cryptosystem CS1. Provides encryption credentials to encrypt, as well as the public variables and values needed for the threshold variant of the Paillier Public Key System. This threshold key includes the public key needed to encrypt a message (i.e. the n and g needed) and the public values needed to verify messages in the threshold scheme (i.e. the verifier v and the public verifier vi for each decryption server).

The public key for the threshold variant is nothing more than the n and g as provided for in PaillierKey and the following additional public variables:

The set of verification keys {vi} is generated by the key generator and passed as an argument to this class, as well as all the above mentioned variables.

The public information contained in this key is sufficient to completely decrypt a ciphertext c, given the k≥w partial decryptions c1,...,ck.

NOTE: This is for the implementation where s=1.

Author:
James Garrity, Sean Hall
See Also:
PaillierThreshold, Serialized Form

Field Summary
private  java.math.BigInteger combineSharesConstant
          The cached value of (4Δ2)-1 mod ns
protected  java.math.BigInteger delta
          Δ=L!; this is used often in decryption algorithms.
protected  int l
          Number of decryption servers L.
private static long serialVersionUID
          This Serial ID
protected  java.math.BigInteger v
          Generates a cyclic group of squares in Z*n2.
protected  java.math.BigInteger[] vi
          Verification key for each of the l decryption servers.
protected  int w
          The minimum of decryption servers needed to make a correct decryption.
 
Fields inherited from class paillierp.key.PaillierKey
k, MAX_KEY_SIZE, n, nPlusOne, ns, nSPlusOne, rnd
 
Constructor Summary
PaillierThresholdKey(java.math.BigInteger n, int l, java.math.BigInteger combineSharesConstant, int w, java.math.BigInteger v, java.math.BigInteger[] viarray, long seed)
          Creates a new public key for the generalized Paillier threshold scheme from the given modulus n, for use on l decryption servers, w of which are needed to decrypt any message encrypted by using this public key.
PaillierThresholdKey(java.math.BigInteger n, int l, int w, java.math.BigInteger v, java.math.BigInteger[] viarray, long seed)
          Creates a new public key for the generalized Paillier threshold scheme from the given modulus n, for use on l decryption servers, w of which are needed to decrypt any message encrypted by using this public key.
PaillierThresholdKey(byte[] b, long seed)
          Creates a new public threshold key using a byte encoding of a key.
 
Method Summary
 java.math.BigInteger getCombineSharesConstant()
          Returns a cached value of (4*Δ)-1 mod n.
 java.math.BigInteger getDelta()
          Returns the cached value Δ=l! where l is the number of decryption servers.
 int getL()
          Returns the number of decryption servers.
 PaillierThresholdKey getThresholdKey()
          The public key that may be used to encrypt data for private Paillier keys.
 java.math.BigInteger getV()
          Returns the public verification value.
 java.math.BigInteger[] getVi()
          Returns the verification keys for each decryption server.
 int getW()
          Returns the threshold number of decryption servers needed to successfully decrypt any ciphertext created by this key.
 byte[] toByteArray()
          Encodes this key into a byte array.
 
Methods inherited from class paillierp.key.PaillierKey
canEncrypt, getK, getN, getNPlusOne, getNS, getNSPlusOne, getPublicKey, getRandomModN, getRandomModNSPlusOneStar, getRandomModNStar, getRnd, inModN, inModN, inModNS, inModNSPlusOne, inModNSPlusOneStar, inModNStar, inModNStar, isCiphertext, isPlaintext, setRnd, setRnd, updateRnd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
This Serial ID

See Also:
Constant Field Values

v

protected java.math.BigInteger v
Generates a cyclic group of squares in Z*n2.


vi

protected java.math.BigInteger[] vi
Verification key for each of the l decryption servers. In essence, vi=vΔsi.


l

protected int l
Number of decryption servers L.


delta

protected java.math.BigInteger delta
Δ=L!; this is used often in decryption algorithms.


w

protected int w
The minimum of decryption servers needed to make a correct decryption.


combineSharesConstant

private java.math.BigInteger combineSharesConstant
The cached value of (4Δ2)-1 mod ns

Constructor Detail

PaillierThresholdKey

public PaillierThresholdKey(java.math.BigInteger n,
                            int l,
                            int w,
                            java.math.BigInteger v,
                            java.math.BigInteger[] viarray,
                            long seed)
Creates a new public key for the generalized Paillier threshold scheme from the given modulus n, for use on l decryption servers, w of which are needed to decrypt any message encrypted by using this public key. The values v and vi correspond to the public values v and vi=vl!si needed to verify the zero knowledge proofs.

Parameters:
n - a safe prime product of p and q where p'=(p-1)/2 and a'=(a-1)/2 are also both primes
l - number of decryption servers
w - threshold of servers needed to successfully decrypt any ciphertext created by this public key.
v - a generator of a cyclic group of squares in Z*n2
viarray - array of verification keys where vi[i] is vl!si where si is the private key for decryption server i
seed - a long integer needed to start a random number generator

PaillierThresholdKey

public PaillierThresholdKey(java.math.BigInteger n,
                            int l,
                            java.math.BigInteger combineSharesConstant,
                            int w,
                            java.math.BigInteger v,
                            java.math.BigInteger[] viarray,
                            long seed)
Creates a new public key for the generalized Paillier threshold scheme from the given modulus n, for use on l decryption servers, w of which are needed to decrypt any message encrypted by using this public key. The values v and vi correspond to the public values v and vi=vl!si needed to verify the zero knowledge proofs.

Parameters:
n - a safe prime product of p and q where p'=(p-1)/2 and a'=(a-1)/2 are also both primes
l - number of decryption servers
combineSharesConstant - precomputed value (4*l!)-1 mod ns
w - threshold of servers needed to successfully decrypt any ciphertext created by this public key. Note that wl/2.
v - a generator of a cyclic group of squares in Z*n2
viarray - array of verification keys where vi[i] is vl!si where si is the private key for decryption server i
seed - a long integer needed to start a random number generator

PaillierThresholdKey

public PaillierThresholdKey(byte[] b,
                            long seed)
Creates a new public threshold key using a byte encoding of a key.

Parameters:
b - Byte array of the necessary values of this private key
seed - a long integer needed to start a random number generator
See Also:
toByteArray()
Method Detail

getThresholdKey

public PaillierThresholdKey getThresholdKey()
The public key that may be used to encrypt data for private Paillier keys. This includes the public values of v and {vi} and l and w

Returns:
The Paillier public key corresponding to this key with with the public verification values.

getV

public java.math.BigInteger getV()
Returns the public verification value.

Returns:
verification value which generates the cyclic group of squares in Z*n2

getVi

public java.math.BigInteger[] getVi()
Returns the verification keys for each decryption server. Used for verification proofs.

Returns:
verification keys for each of the l decryption servers

getL

public int getL()
Returns the number of decryption servers.

Returns:
the number of decryption servers

getDelta

public java.math.BigInteger getDelta()
Returns the cached value Δ=l! where l is the number of decryption servers. This is frequently used for decryption.

Returns:
the value l!

getW

public int getW()
Returns the threshold number of decryption servers needed to successfully decrypt any ciphertext created by this key.

Returns:
the minimum number of decryption servers needed to make a correct decryption

getCombineSharesConstant

public java.math.BigInteger getCombineSharesConstant()
Returns a cached value of (4*Δ)-1 mod n. This value is heavily used for decryption.

Returns:
the inverse of (4Δ) in Zn

toByteArray

public byte[] toByteArray()
Encodes this key into a byte array. As this is a public threshold key, the public modulo n, l, w, v, and vi will be encoded in that order. Further, before each BigInteger (except n) is the 4-byte equivalent to the size of the BigInteger for later parsing.

Overrides:
toByteArray in class PaillierKey
Returns:
a byte array containing the most necessary values of this key. A byte array of size 0 is returned if the key would be too large.
See Also:
PaillierThresholdKey(byte[], long), BigInteger.toByteArray()