|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpaillierp.key.PaillierKey
paillierp.key.PaillierPrivateKey
public class PaillierPrivateKey
A simple private key for the generalized Paillier cryptosystem CS1.
The private key for the generalized Paillier cryptosystem
CSs constructed in Damgård et al. requires the public
key values of n and g (as provided for in PaillierKey
),
and the secret value d as defined as follows:
PaillierKey
,
Serialized FormField Summary | |
---|---|
protected java.math.BigInteger |
d
Secret key; d mod n∈Z*n and d = 0 mod λ, where λ is least common multiple of p-1 and q-1. |
protected java.math.BigInteger |
dInvs
The inverse of d mod ns. |
private static long |
serialVersionUID
This Serial ID |
Fields inherited from class paillierp.key.PaillierKey |
---|
k, MAX_KEY_SIZE, n, nPlusOne, ns, nSPlusOne, rnd |
Constructor Summary | |
---|---|
PaillierPrivateKey(java.math.BigInteger p,
java.math.BigInteger q,
java.math.BigInteger d,
long seed)
Creates a new private key when given the primes p and q and the secret value d. |
|
PaillierPrivateKey(java.math.BigInteger n,
java.math.BigInteger d,
long seed)
Creates a new private key when given the modulus n and the secret value d. |
|
PaillierPrivateKey(byte[] b,
long seed)
Creates a new private key using a byte encoding of a key. |
Method Summary | |
---|---|
boolean |
canEncrypt()
Describes if this key can be used to encrypt |
java.math.BigInteger |
getD()
Accesses the secret integer d chosen at the creation of this secret key. |
java.math.BigInteger |
getDInvs()
Access the precomputed inverse of d in
Z*ns+1. |
byte[] |
toByteArray()
Encodes this key into a byte array. |
java.math.BigInteger[] |
toIntArray()
Returns a BigInt array corresponding to this Paillier pubilc key. |
Methods inherited from class paillierp.key.PaillierKey |
---|
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 |
---|
private static final long serialVersionUID
protected java.math.BigInteger d
protected java.math.BigInteger dInvs
Constructor Detail |
---|
public PaillierPrivateKey(java.math.BigInteger n, java.math.BigInteger d, long seed)
seed
to create the public key with a
SecureRandom
random number generator.
n
- a RSA modulus. That is, the product of two
different odd primes p, q.d
- an integer that should be a multiple of the least
common multiple of p-1 and q-1, and
relatively prime to n
seed
- a long integer needed to start a random
number generatorpublic PaillierPrivateKey(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger d, long seed)
seed
to create the public key with a
SecureRandom
random number generator.
p
- one allowable prime for our modulusq
- another prime for our modulus, different fromd
- an integer that should be a multiple of the least
common multiple of p-1
and
q-1
, and relatively prime to
p*q
seed
- a long integer needed to start a random
number generatorpublic PaillierPrivateKey(byte[] b, long seed)
b
- Byte array of the necessary values of this private keyseed
- a long integer needed to start a random number generatortoByteArray()
Method Detail |
---|
public boolean canEncrypt()
canEncrypt
in class PaillierKey
public java.math.BigInteger getD()
public java.math.BigInteger getDInvs()
d
in
Z*ns+1. This
allows one to decrypt a little more expediently.
d
in mod
n
2getD()
public java.math.BigInteger[] toIntArray()
public byte[] toByteArray()
n
, d
will be encoded in that order.
Further, before d
is the 4-byte equivalent to the size of
the BigInteger for later parsing.
toByteArray
in class PaillierKey
PaillierPrivateKey(byte[], long)
,
BigInteger.toByteArray()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |