Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia
Class GatherEntropy

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.GatherEntropy

public class GatherEntropy
extends Object

GatherEntropy initializes the Fortuna PRNG with entropy data. GatherEntropy gets the media device configuration and checks which media systems are available. It then reads some data fom media input (capture) devices and uses this data to seed the Fortuna PRNG. The ZrtpFortuna PRNG is a singleton and all other methods that require random data shall use this singleton. Use GatherEntropy during startup and initialization phase of SIP Communicator but after initialization of the media devices to get entropy data at the earliest point. Also make sure that entropy data is read from local sources only and that entropy data is never send out (via networks for example).

Author:
Werner Dittmann , Lubomir Marinov

Constructor Summary
GatherEntropy(DeviceConfiguration deviceConfiguration)
          Constructor.
 
Method Summary
protected  int getGatheredEntropy()
           
static boolean isEntropyOk()
          Get status of entropy flag.
 boolean setEntropy()
          Set entropy to ZrtpFortuna singleton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GatherEntropy

public GatherEntropy(DeviceConfiguration deviceConfiguration)
Constructor.

Parameters:
deviceConfiguration - DeviceConfiguration needed to initialize GatherEntropy
Method Detail

isEntropyOk

public static boolean isEntropyOk()
Get status of entropy flag.

Returns:
Status if entropy was gathered and set in Fortuna PRNG.

getGatheredEntropy

protected int getGatheredEntropy()
Returns:
the number of gathered entropy bytes.

setEntropy

public boolean setEntropy()
Set entropy to ZrtpFortuna singleton. The methods reads entropy data and seeds the ZrtpFortuna singleton. The methods seeds the first pool (0) of Fortuna to make sure that this entropy is always used.

Returns:
true if entropy data was available, false otherwise.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.