|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.security.random.SeedGenerator | +--iaik.security.random.HashObjectSeedGenerator | +--iaik.security.random.AWT11SeedGenerator
This class generates a PRNG seed from user generated AWT events following
the JDK 1.1 AWT event model. It is a subclass of HashObjectSeedGenerator
and uses its API, see there for more documentation.
The API:
A seedGenListener should implement at least one of the MouseMotionListener, MouseListener, and KeyListener interfaces. The default listener implements all of them, but only uses the mousePressed, mouseMoved, mouseDragged, and keyTyped events to build the random seed. The other events are ignored for the reasons explained below. If you write your own listener, just make it call addSeedObject() for all events you wish to use for seeding.
Every time addEvent() is called, it will add the current time as returned by System.currentTimeMillis(), the string representation of the event as obtained by toString(), and the identityHashCode() of the event to the input of an SHA-1 hash. The string representation of an event contains all the information about the event (event source, event type, event parameters, etc). When getSeed() is finally called, the hash is returned, therefore it is always 20 bytes long. This also means, that one instance of this class can generate no more than 160 random bits.
This class assumes that the amount of uncertainty per event is (on average) at least three bits per event. In other words this means that an attacker would have to use no more than eight tries (on average) to guess all of these correctly:
Fields inherited from class iaik.security.random.SeedGenerator |
seedGenListener |
Constructor Summary | |
AWT11SeedGenerator()
Generate a seed generator for the default number of random bits (currently 136). |
|
AWT11SeedGenerator(int numBits)
Generate a seed generator for the specified number of bits. |
Method Summary | |
boolean |
addEvent(AWTEvent event)
Deprecated. use addSeedObject() instead. |
void |
addEventSource(Component component)
Add a component as a source of events. |
protected int |
extractSeedData(Object obj)
Add the given event to the seed. |
void |
setEventListener(Object listener)
Set the event listener that will pass the events to us. |
Methods inherited from class iaik.security.random.HashObjectSeedGenerator |
addSeedObject, getMessageDigest, getSeed, getStatus, updateHash, updateHash, updateHash |
Methods inherited from class iaik.security.random.SeedGenerator |
callSeedGenListener, getDefault, getDefaultSeedGenerator, longToBytes, seedAvailable, setDefault, setDefaultSeedGenerator, setSeedGenListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AWT11SeedGenerator(int numBits)
public AWT11SeedGenerator()
Method Detail |
public void setEventListener(Object listener)
public void addEventSource(Component component)
public boolean addEvent(AWTEvent event)
protected int extractSeedData(Object obj) throws IllegalArgumentException
addSeedObject()
with the object
passed to it.extractSeedData
in class HashObjectSeedGenerator
RandomException
- if obj is not a subclass of java.awt.event.AWTEvent
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |