|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpaillierp.zkp.ZKP
paillierp.zkp.EncryptionZKP
public class EncryptionZKP
A non-interactive Zero Knowledge Proof that the ciphertext is of a known message. This Zero Knowledge Proof correctly proves that one knows the plaintext m and random number r in the ciphertext E(m, r). This is done without revealing either the plaintext nor the random number.
The protocol is given on p. 41 in Multiparty Computation from Threshold Homomorphic Encryption by Cramer, Damgård, and Nielsen.
Field Summary | |
---|---|
private java.math.BigInteger |
b
gxun mod n2 for random x, u. |
private java.math.BigInteger |
c
Ciphertext E(α, r). |
private java.math.BigInteger |
n
|
private java.math.BigInteger |
nSPlusOne
|
private static long |
serialVersionUID
This Serial ID |
private java.math.BigInteger |
w
The value x+eα for the plaintext α and random x. |
private java.math.BigInteger |
z
usegt mod n2 for hash e and g=n+1. |
Fields inherited from class paillierp.zkp.ZKP |
---|
hashFunction |
Constructor Summary | |
---|---|
EncryptionZKP(byte[] b)
Creates an instance of the Zero Knowledge Proof of decryption from a byte array which does have the key encoded. |
|
EncryptionZKP(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. |
|
EncryptionZKP(byte[] b,
PaillierKey pubkey)
Creates an instance of the Zero Knowledge Proof from a byte array (which does not have the key) and a public key. |
|
EncryptionZKP(PaillierKey key,
java.math.BigInteger alpha)
Computes a random encryption of alpha . |
Method Summary | |
---|---|
java.math.BigInteger |
getValue()
The encrypted value 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 encryption 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 |
---|
private static final long serialVersionUID
private java.math.BigInteger nSPlusOne
private java.math.BigInteger n
private java.math.BigInteger z
private java.math.BigInteger w
private java.math.BigInteger b
private java.math.BigInteger c
Constructor Detail |
---|
public EncryptionZKP(byte[] b)
b
- byte array of the necessary values for a ZKP
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.toByteArray()
public EncryptionZKP(byte[] b, java.math.BigInteger nSPlusOne, java.math.BigInteger n)
b
, then
those values are used.
b
- byte array of the necessary values for a ZKPnSPlusOne
- the public key modulus ns+1n
- the public key modulus ntoByteArrayNoKey()
public EncryptionZKP(byte[] b, PaillierKey pubkey)
b
, then those
values are used.
b
- byte array of the necessary values for a ZKPpubkey
- public Paillier key to provide further recurring
values for a ZKPtoByteArrayNoKey()
public EncryptionZKP(PaillierKey key, java.math.BigInteger alpha)
alpha
. This additionally sets up
a Zero Knowledge Proof that this multiplication was done, without
revealing anything of alpha
.
key
- Public key n used to encryptalpha
- The message αMethod Detail |
---|
public java.math.BigInteger getValue()
getValue
in class ZKP
public boolean verify()
verify
in class ZKP
public boolean verifyKey(PaillierKey origkey)
origkey
- A given key
origkey
public byte[] toByteArray()
n
) is the 4-byte
equivalent to the size of the BigInteger for later parsing.
toByteArray
in class ZKP
EncryptionZKP(byte[])
,
BigInteger.toByteArray()
public byte[] toByteArrayNoKey()
n
) is the 4-byte
equivalent to the size of the BigInteger for later parsing.
toByteArrayNoKey
in class ZKP
EncryptionZKP(byte[], PaillierKey)
,
BigInteger.toByteArray()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |