paillierp.zkp
Class MultiplicationZKP

java.lang.Object
  extended by paillierp.zkp.ZKP
      extended by paillierp.zkp.MultiplicationZKP
All Implemented Interfaces:
java.io.Serializable

public class MultiplicationZKP
extends ZKP

A non-interactive Zero Knowledge Proof that the multiplication of a ciphertext is done. This Zero Knowledge Proof will correctly validate whether the message of the ciphertext E(a) was indeed multiplied by a constant α. This is done without revealing the value α and without interaction.

The protocol is given on p. 40 in Multiparty Computation from Threshold Homomorphic Encryption by Cramer, Damgård, and Nielsen.

Author:
Murat Kantarcioglu, Sean Hall, James Garrity
See Also:
Serialized Form

Field Summary
private  java.math.BigInteger a
          A random encryption of E(xa) for chosen x.
private  java.math.BigInteger b
          A random encryption of x.
private  java.math.BigInteger c
          A random encryption of α.
private  java.math.BigInteger ca
          The original encryption E(a).
private  java.math.BigInteger d
          A random encryption of E(a&alpha).
private  java.math.BigInteger n
          The public key modulo.
private  java.math.BigInteger nSPlusOne
          The public key modulo to the s+1 power.
private static long serialVersionUID
          This Serial ID
private  java.math.BigInteger w
          x+eα mod n
private  java.math.BigInteger y
          vCatγe mod n2
private  java.math.BigInteger z
          usegt mod n2
 
Fields inherited from class paillierp.zkp.ZKP
hashFunction
 
Constructor Summary
MultiplicationZKP(byte[] b)
          Creates an instance of the Zero Knowledge Proof of decryption from a byte array which does have the key encoded.
MultiplicationZKP(byte[] b, java.math.BigInteger nSPlusOne, java.math.BigInteger n)
          Creates an instance of the Zero Knowledge Proof from a byte array (which does not have the key) and the values necessary for verification.
MultiplicationZKP(byte[] b, PaillierThresholdKey pubkey)
          Creates an instance of the Zero Knowledge Proof from a byte array (which does not have the key) and a public key.
MultiplicationZKP(PaillierKey key, java.math.BigInteger ca, java.math.BigInteger alpha)
          Computes a random encryption of αa where a is the message encrypted in ca.
 
Method Summary
 java.math.BigInteger getValue()
          A random encryption of .
 byte[] toByteArray()
          Encodes this ZKP into a byte array.
 byte[] toByteArrayNoKey()
          Encodes this ZKP into a byte array.
 boolean verify()
          Verifies if all of the above integers are indeed true, thereby showing that this multiplication is exact.
 boolean verifyKey(PaillierKey origkey)
          Verifies that the values used in this Zero Knowledge Proof corresponds to the given key.
 
Methods inherited from class paillierp.zkp.ZKP
hash
 
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

ca

private java.math.BigInteger ca
The original encryption E(a).


c

private java.math.BigInteger c
A random encryption of α.


d

private java.math.BigInteger d
A random encryption of E(a&alpha).


a

private java.math.BigInteger a
A random encryption of E(xa) for chosen x.


b

private java.math.BigInteger b
A random encryption of x.


w

private java.math.BigInteger w
x+eα mod n


y

private java.math.BigInteger y
vCatγe mod n2


z

private java.math.BigInteger z
usegt mod n2


n

private java.math.BigInteger n
The public key modulo.


nSPlusOne

private java.math.BigInteger nSPlusOne
The public key modulo to the s+1 power.

Constructor Detail

MultiplicationZKP

public MultiplicationZKP(byte[] b)
Creates an instance of the Zero Knowledge Proof of decryption from a byte array which does have the key encoded.

Parameters:
b - byte array of the necessary values for a ZKP
Throws:
java.lang.IllegalArgumentException - if it detects that some corruption has occured, for example, if the "size of next BigInteger" field is a larger number than typical causing out of bounds issues.
See Also:
toByteArray()

MultiplicationZKP

public MultiplicationZKP(byte[] b,
                         java.math.BigInteger nSPlusOne,
                         java.math.BigInteger n)
Creates an instance of the Zero Knowledge Proof from a byte array (which does not have the key) and the values necessary for verification. If the key values were originally encoded into b, then those values are used.

Parameters:
b - byte array of the necessary values for a ZKP
nSPlusOne - the public key modulus ns+1
n - the public key modulus n
See Also:
toByteArrayNoKey()

MultiplicationZKP

public MultiplicationZKP(byte[] b,
                         PaillierThresholdKey pubkey)
Creates an instance of the Zero Knowledge Proof from a byte array (which does not have the key) and a public key. If the key values were originally encoded into b, then those values are used.

Parameters:
b - byte array of the necessary values for a ZKP
pubkey - public Paillier key to provide further recurring values for a ZKP
See Also:
toByteArrayNoKey()

MultiplicationZKP

public MultiplicationZKP(PaillierKey key,
                         java.math.BigInteger ca,
                         java.math.BigInteger alpha)
Computes a random encryption of αa where a is the message encrypted in ca. This additionally sets up a Zero Knowledge Proof that this multiplication was done, without revealing anything of α.

Parameters:
key - Public key n under which ca was encrypted
ca - The encryption E(a, r)
alpha - The constant α
Method Detail

getValue

public java.math.BigInteger getValue()
A random encryption of .

Specified by:
getValue in class ZKP
Returns:
E(, r) for some random r

verify

public boolean verify()
Verifies if all of the above integers are indeed true, thereby showing that this multiplication is exact.

Specified by:
verify in class ZKP
Returns:
True if the computed value is indeed a random encryption of a multiplication

verifyKey

public boolean verifyKey(PaillierKey origkey)
Verifies that the values used in this Zero Knowledge Proof corresponds to the given key.

Parameters:
origkey -
Returns:
True iff the modulus of this ZKP is the same as the modulus of the provided key.

toByteArray

public byte[] toByteArray()
Encodes this ZKP into a byte array. All of the necessary values (including the public key values) needed to verify the veracity of this ciphertext multiplication are encoded. Before each BigInteger (except n) is the 4-byte equivalent to the size of the BigInteger for later parsing.

Specified by:
toByteArray in class ZKP
Returns:
a byte array containing the most necessary values of this ZKP. A byte array of size 0 is returned if the byte array would be too large.
See Also:
MultiplicationZKP(byte[]), BigInteger.toByteArray()

toByteArrayNoKey

public byte[] toByteArrayNoKey()
Encodes this ZKP into a byte array. All of the necessary values (besides the public key values) needed to verify the veracity of this ciphertext multiplication are encoded. Before each BigInteger (except n) is the 4-byte equivalent to the size of the BigInteger for later parsing.

Specified by:
toByteArrayNoKey in class ZKP
Returns:
a byte array containing the most necessary values of this ZKP. A byte array of size 0 is returned if the byte array would be too large.
See Also:
MultiplicationZKP(byte[], PaillierThresholdKey), BigInteger.toByteArray()