|
FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
|
The ElGamal crypto scheme. More...

Classes | |
| class | ElGamalPublicKeyShare |
| A public key share. More... | |
Public Member Functions | |
| ElGamalScheme (Element params) | |
| Constructor. | |
| AddableInteger | decrypt (ElGamalBigInteger initialCypherText, ElGamalBigInteger partialDecryption) |
| ElGamalBigInteger | encrypt (AddableInteger cleartext) |
| ElGamalBigInteger | encrypt (AddableInteger cleartext, AddableInteger bound) |
| ElGamalBigInteger | reencrypt (ElGamalBigInteger cyphertext) |
| ElGamalBigInteger | partialDecrypt (ElGamalBigInteger initialCypherText, ElGamalBigInteger partialDecryption) |
| void | addPublicKeyShare (ElGamalPublicKeyShare share) |
| ElGamalPublicKeyShare | newPublicKeyShare () |
| String | toString () |
| Public Member Functions inherited from frodo2.solutionSpaces.crypto.CryptoScheme< AddableInteger, ElGamalBigInteger, ElGamalScheme.ElGamalPublicKeyShare > | |
| K | newPublicKeyShare () |
| void | addPublicKeyShare (K share) |
| Records another share of the public key. | |
| E | encrypt (C cleartext) |
| Encrypts a cleartext. | |
| E | reencrypt (E cyphertext) |
| Re-encrypts a cyphertext. | |
| E | partialDecrypt (E initialCypherText, E partialDecryption) |
| Partially decrypts a cyphertext. | |
| C | decrypt (E initialCypherText, E partialDecryption) |
| Decrypts a cyphertext. | |
Static Public Member Functions | |
| static void | main (String[] args) |
| Creates a safe prime and a generator for use with the ElGamal scheme. | |
Private Member Functions | |
| BigInteger | randomBigInteger () |
| boolean | isPowerOf2 (BigInteger nbr) |
| Tests whether a number is a power of 2. | |
Static Private Member Functions | |
| static BigInteger | getSafePrime (BigInteger r, BigInteger t) |
| Return a safe prime number. | |
| static void | getSafePrimeAndGenerator () |
| Generate a safe prime, its generator and print them out. | |
| static ArrayList< BigInteger > | getFactors (BigInteger r, BigInteger t) |
| Returns the list of prime factors of 2rt. | |
| static BigInteger | getGenerator (ArrayList< BigInteger > factors, BigInteger prime, SecureRandom rand) |
| Return a generator. | |
Private Attributes | |
| final BigInteger | p |
| Prime number. | |
| final BigInteger | pMinus3 |
| p - 3 | |
| final int | nbrBitsOfPminus3 |
| The number of bits of p - 3. | |
| final BigInteger | g |
| Number such that gcd(g,p) = 1. | |
| BigInteger | y |
| The overall public key, as the product of all the (g^x mod p) shares. | |
| BigInteger | x |
| private key in [1, p-2] | |
| final int | size |
| The default size of the ElGamal vector. | |
| final SecureRandom | rand |
| Random generator. | |
| final boolean | debug |
| If true, does not actually perform encryption/decryption. | |
Static Private Attributes | |
| static final long | serialVersionUID = -4409105662996332812L |
| Used for serialization. | |
| static int | certainty |
| Parameter used to create P. | |
| static int | minBitLength |
| Parameter used to create P. | |
The ElGamal crypto scheme.
| frodo2.solutionSpaces.crypto.ElGamalScheme.ElGamalScheme | ( | Element | params | ) |
| void frodo2.solutionSpaces.crypto.ElGamalScheme.addPublicKeyShare | ( | ElGamalPublicKeyShare | share | ) |
| AddableInteger frodo2.solutionSpaces.crypto.ElGamalScheme.decrypt | ( | ElGamalBigInteger | initialCypherText, |
| ElGamalBigInteger | partialDecryption ) |
References debug, isPowerOf2(), p, frodo2.solutionSpaces.AddableInteger.PlusInfinity.PLUS_INF, frodo2.solutionSpaces.crypto.ElGamalBigInteger.vector, and x.
Referenced by frodo2.solutionSpaces.crypto.ElGamalSchemeTest.min(), and frodo2.solutionSpaces.crypto.ElGamalSchemeTest.randomDecryptOnce().

| ElGamalBigInteger frodo2.solutionSpaces.crypto.ElGamalScheme.encrypt | ( | AddableInteger | cleartext | ) |
Referenced by frodo2.solutionSpaces.crypto.ElGamalSchemeTest.min(), and frodo2.solutionSpaces.crypto.ElGamalSchemeTest.randomDecryptOnce().
| ElGamalBigInteger frodo2.solutionSpaces.crypto.ElGamalScheme.encrypt | ( | AddableInteger | cleartext, |
| AddableInteger | bound ) |
infinity References frodo2.solutionSpaces.AddableInteger.intValue(), and frodo2.solutionSpaces.AddableInteger.PlusInfinity.PLUS_INF.

|
staticprivate |
Returns the list of prime factors of 2rt.
| r | a large random number |
| t | a prime number |
Referenced by getSafePrimeAndGenerator().
|
staticprivate |
Return a generator.
| factors | the list of the factor of the safe prime minus one (2rt-1) |
| prime | a safe prime |
| rand | an instance of SecureRandom |
Referenced by getSafePrimeAndGenerator().
|
staticprivate |
Return a safe prime number.
| r | a large random number |
| t | a large prime number |
References certainty.
Referenced by getSafePrimeAndGenerator().
|
staticprivate |
Generate a safe prime, its generator and print them out.
References certainty, frodo2.generator, getFactors(), getGenerator(), getSafePrime(), minBitLength, and rand.
Referenced by main().

|
private |
Tests whether a number is a power of 2.
| nbr | the number to test |
Referenced by decrypt().
|
static |
Creates a safe prime and a generator for use with the ElGamal scheme.
| args | minimum bit length, and prime certainty |
References certainty, getSafePrimeAndGenerator(), and minBitLength.

| ElGamalPublicKeyShare frodo2.solutionSpaces.crypto.ElGamalScheme.newPublicKeyShare | ( | ) |
References g, p, and randomBigInteger().
Referenced by frodo2.solutionSpaces.crypto.ElGamalSchemeTest.init().

| ElGamalBigInteger frodo2.solutionSpaces.crypto.ElGamalScheme.partialDecrypt | ( | ElGamalBigInteger | initialCypherText, |
| ElGamalBigInteger | partialDecryption ) |
References debug, p, frodo2.solutionSpaces.crypto.ElGamalBigInteger.vector, and x.
Referenced by frodo2.solutionSpaces.crypto.ElGamalSchemeTest.min(), and frodo2.solutionSpaces.crypto.ElGamalSchemeTest.randomDecrypt().
|
private |
Referenced by newPublicKeyShare(), and reencrypt().
| ElGamalBigInteger frodo2.solutionSpaces.crypto.ElGamalScheme.reencrypt | ( | ElGamalBigInteger | cyphertext | ) |
References debug, g, p, randomBigInteger(), frodo2.solutionSpaces.crypto.ElGamalBigInteger.vector, and y.
Referenced by frodo2.solutionSpaces.crypto.ElGamalSchemeTest.min(), frodo2.solutionSpaces.crypto.ElGamalSchemeTest.randomDecrypt(), and frodo2.solutionSpaces.crypto.ElGamalSchemeTest.randomDecryptOnce().

| String frodo2.solutionSpaces.crypto.ElGamalScheme.toString | ( | ) |
|
staticprivate |
Parameter used to create P.
Represents the certainty that p is prime
Referenced by getSafePrime(), getSafePrimeAndGenerator(), and main().
|
private |
If true, does not actually perform encryption/decryption.
Referenced by decrypt(), partialDecrypt(), and reencrypt().
|
private |
Number such that gcd(g,p) = 1.
Referenced by ElGamalScheme(), newPublicKeyShare(), and reencrypt().
|
staticprivate |
Parameter used to create P.
Represents the minimum bit length of p
Referenced by getSafePrimeAndGenerator(), and main().
|
private |
The number of bits of p - 3.
|
private |
Prime number.
Referenced by addPublicKeyShare(), decrypt(), ElGamalScheme(), newPublicKeyShare(), partialDecrypt(), and reencrypt().
|
private |
p - 3
Referenced by ElGamalScheme().
|
private |
Random generator.
Referenced by ElGamalScheme(), getGenerator(), and getSafePrimeAndGenerator().
|
staticprivate |
Used for serialization.
|
private |
The default size of the ElGamal vector.
Referenced by ElGamalScheme(), and getGenerator().
|
private |
private key in [1, p-2]
Referenced by decrypt(), getGenerator(), and partialDecrypt().
|
private |
The overall public key, as the product of all the (g^x mod p) shares.
Referenced by reencrypt().