|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Random | +--java.security.SecureRandom | +--iaik.security.random.SecRandom | +--iaik.security.random.MessageDigestRandom
This class implements a secure pseudo-random number generator based on a MessageDigest. It cannot be used directly and has to be subclassed. Subclasses just have to call the superclass constructor with the MessageDigest object as parameter, everything else is taken care of. It will work for digests of any length.
The method used to generate the random bytes is based on a paper from BSI (Bundesamt fuer Sicherheit in der Informationstechnik) called AIS 20 (Anwendungshinweise und Interpretationen zum Schema), version 2.0, 02.12.1999. This algorithm is described in example E.5 of this paper.
Seeding of this implementation causes the new seed value to be
concatenated with the existing internal seed. The hash of this
concatenation becomes the new internal seed.
This means that the entropy of the internal seed is limited by the size
of the hash values produced by the used hash algorithm; i.e. 160 bit for
SHA-1.
Given a good message digest algorithm, the output will be evenly distributed. Due to the one-way property of the message digest function, it is infeasible to deduct the seed from the random bytes. The same holds for predicting future (or past) output knowing only previous and/or following output bytes.
MD5Random
,
SHA1Random
,
SHA256Random
,
SHA512Random
,
RipeMd160Random
,
SeedGenerator
, Serialized FormConstructor Summary | |
protected |
MessageDigestRandom(MessageDigest digest)
Constructor for use by subclasses. |
Method Summary | |
protected void |
engineNextBytes(byte[] bytes)
Return bytes.length random bytes. |
protected void |
engineSetSeed(byte[] seed)
Add this seed to the internal seed. |
Methods inherited from class iaik.security.random.SecRandom |
getDefault, nextBytes, setDefault, setSeed, setSeed, setSeed |
Methods inherited from class java.security.SecureRandom |
generateSeed, getInstance, getInstance, getProvider, getSeed, next |
Methods inherited from class java.util.Random |
nextBoolean, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected MessageDigestRandom(MessageDigest digest)
Method Detail |
protected void engineSetSeed(byte[] seed)
engineSetSeed
in class SecRandom
protected void engineNextBytes(byte[] bytes)
engineNextBytes
in class SecRandom
|
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 |