|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpaillierp.AbstractPaillier
public abstract class AbstractPaillier
An abstract class of the simple Paillier cryptosystem. This class
is intended for use in both the Paillier
and
PaillierThreshold
implementations of the generalized Paillier
cryptosystem by Damgård.
This includes methods and fields common to both implementations, especially encryption and operations on ciphertexts; more specifically, the following operations are provided in this abstract class:
Note that every ciphertext and plaintext is a BigInteger
.
Paillier
,
PaillierThreshold
Field Summary | |
---|---|
protected boolean |
decryptMode
Boolean signifying that the variables for decryption are in place. |
protected boolean |
encryptMode
Boolean signifying that the variables for encryption are in place. |
protected PaillierKey |
key
Public Key allowing encryption. |
protected java.lang.String |
notReadyForDecryption
String for error messages indicating that decryptMode
is not set. |
protected java.lang.String |
notReadyForEncryption
String for error messages indicating that encryptMode
is not set. |
Constructor Summary | |
---|---|
AbstractPaillier()
|
Method Summary | |
---|---|
java.math.BigInteger |
add(java.math.BigInteger c1,
java.math.BigInteger c2)
Calculates E(m1+m2) given E(m1) and E(m2). |
static java.math.BigInteger |
add(java.math.BigInteger c1,
java.math.BigInteger c2,
java.math.BigInteger nsplus1)
Calculates E(m1+m2) given E(m1) and E(m2), for a given cryptosystem CSs with public key n |
java.math.BigInteger |
encrypt(java.math.BigInteger m)
Produces the random encryption of m . |
java.math.BigInteger |
encrypt(java.math.BigInteger m,
java.math.BigInteger r)
Produces the encryption E( m , r ) using the
message m and the randomization r
in the Paillier cryptosystem. |
static java.math.BigInteger |
encrypt(java.math.BigInteger m,
java.math.BigInteger r,
java.math.BigInteger n,
java.math.BigInteger ns,
java.math.BigInteger nSPlusOne)
Produces the encryption E( m, r ). |
static java.math.BigInteger |
encrypt(java.math.BigInteger m,
java.math.BigInteger r,
PaillierKey key)
Produces the encryption E( m, r ). |
static java.math.BigInteger |
encrypt(java.math.BigInteger m,
PaillierKey key)
Produces a random encryption of m |
java.math.BigInteger |
encryptone()
A random encryption of 1. |
EncryptionZKP |
encryptProof(java.math.BigInteger m)
Produces a Zero Knowledge Proof of the encryption m |
java.math.BigInteger |
encryptzero()
A random encryption of 0. |
PaillierKey |
getPublicKey()
Returns the simple public key already in use in this instance of the cryptosystem. |
java.math.BigInteger |
multiply(java.math.BigInteger c1,
java.math.BigInteger cons)
Calculates E( cons* m) given E(m)
and the constant cons , under our current public key. |
static java.math.BigInteger |
multiply(java.math.BigInteger c,
java.math.BigInteger cons,
java.math.BigInteger nSquare)
Calculates E( cons* m) given E(m)
and the constant cons , under the public key n for
crypto system CSs. |
java.math.BigInteger |
multiply(java.math.BigInteger c1,
long cons)
Calculates E( cons* m) given E(m)
and the constant cons , under our current public key. |
MultiplicationZKP |
multiplyProof(java.math.BigInteger c1,
java.math.BigInteger cons)
Calculates E( cons* m) given E(m)
and the constant cons , under our current public key. |
java.math.BigInteger |
randomize(java.math.BigInteger c)
Randomizes a given encryption by the given variable. |
java.math.BigInteger |
randomize(java.math.BigInteger c,
java.math.BigInteger r)
Randomizes a given encryption by the given variable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PaillierKey key
protected boolean encryptMode
protected boolean decryptMode
protected java.lang.String notReadyForEncryption
encryptMode
is not set.
protected java.lang.String notReadyForDecryption
decryptMode
is not set.
Constructor Detail |
---|
public AbstractPaillier()
Method Detail |
---|
public PaillierKey getPublicKey()
null
if no key has yet to be specified.
null
if the key is not initialized.public java.math.BigInteger encrypt(java.math.BigInteger m)
m
.
m
- plaintext to be encrypted; must be less than
n
s
m
,r)
with a random rpublic java.math.BigInteger encrypt(java.math.BigInteger m, java.math.BigInteger r)
m
, r
) using the
message m
and the randomization r
in the Paillier cryptosystem.
m
- plaintext to be encrypted; must be less than
n
sr
- randomizer integer for the encryption; must be
relatively prime to n
and less than
n
m
,r
)public static java.math.BigInteger encrypt(java.math.BigInteger m, PaillierKey key)
m
m
- Message to be encoded; m<ns
key
- Public Key doing the encoding
m
, r) using
the public key key
with random rpublic static java.math.BigInteger encrypt(java.math.BigInteger m, java.math.BigInteger r, PaillierKey key)
m, r
).
m
- Message to be encoded; m<ns
r
- Random number in Z*n
key
- Public Key doing the encoding
m, r
) using
the public key key
public static java.math.BigInteger encrypt(java.math.BigInteger m, java.math.BigInteger r, java.math.BigInteger n, java.math.BigInteger ns, java.math.BigInteger nSPlusOne)
m, r
).
m
- Message to be encoded; m<ns
r
- Random number in Z*n
n
- RSA modulusns
- The value n
snSPlusOne
- The value n
s+1
m, r
) using
the public key n
public EncryptionZKP encryptProof(java.math.BigInteger m)
m
m
- A message to be encrypted (must be less than n
m
public java.math.BigInteger encryptzero()
public java.math.BigInteger encryptone()
public java.math.BigInteger add(java.math.BigInteger c1, java.math.BigInteger c2)
c1
- the encryption E(m1)c2
- the encryption E(m2)
public static java.math.BigInteger add(java.math.BigInteger c1, java.math.BigInteger c2, java.math.BigInteger nsplus1)
c1
- the encryption E(m1) under the
public key nc2
- the encryption E(m2) under the
public key nnsplus1
- n to the (s+1)th power
public java.math.BigInteger multiply(java.math.BigInteger c1, long cons)
cons*
m) given E(m)
and the constant cons
, under our current public key.
c1
- the encryption E(m)cons
- the integer multiplicand
cons*
m)public java.math.BigInteger multiply(java.math.BigInteger c1, java.math.BigInteger cons)
cons*
m) given E(m)
and the constant cons
, under our current public key.
c1
- the encryption E(m)cons
- the integer multiplicand
cons*
m)public MultiplicationZKP multiplyProof(java.math.BigInteger c1, java.math.BigInteger cons)
cons*
m) given E(m)
and the constant cons
, under our current public key. This
method then returns a non-interactive Zero Knowledge Proof that
the resulting encryption (i.e. E(cons*
m)) is
indeed the encryption of the multiplication of m by cons
.
c1
- the encryption E(m)cons
- the integer multiplicand
cons*
m)public static java.math.BigInteger multiply(java.math.BigInteger c, java.math.BigInteger cons, java.math.BigInteger nSquare)
cons*
m) given E(m)
and the constant cons
, under the public key n for
crypto system CSs.
c
- the encryption E(m) under the
public key ncons
- the integer multiplicandnSquare
- n to the (s+1)th power
cons*
m)
under the supposed public key n in cryptosystem
CSspublic java.math.BigInteger randomize(java.math.BigInteger c, java.math.BigInteger r)
r
).
c
- the encryption E(m,r')r
- randomizer variable; must be relatively prime to
n and less than n
r
)public java.math.BigInteger randomize(java.math.BigInteger c)
c
- the encryption E(m,r)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |