I think Solaris does not have /dev/random or /dev/urandom, so that's why AutoSeededRandomPool is not available. However I just did a web search that indicates some versions of Solaris 8 and 9 may have /dev/random now. So you can enable it, by doing a search and replace from "defined(__FreeBSD__) || defined(__linux__)" to "defined(__unix__)" in osrng.h and osrng.cpp. AutoSeededRandomPool will throw a run-time exception if it can't open /dev/urandom.
This web page gives other methods of generating random numbers: http://www.cs.berkeley.edu/~daw/rnd/. Unfortunately none of them are nearly as easy as using AutoSeededRandomPool. On Tue, Oct 01, 2002 at 04:19:17AM +0800, Ng Keng Seng wrote: > Dear all, > > (1) i trying to generate RSA Key by utilizing AutoSeededRandomPool (as shown below). > --------------------------------------------------------------------------------------------- > | AutoSeededRandomPool randPool; > | RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength); > | HexEncoder privKey(new StringSink(secstring)); > | ...etc > --------------------------------------------------------------------------------------------- > However, my Solaris complains "AutoSeededRandomPool undeclared". > Q1: Is there any other method to generate an auto seeded random number (in Solaris) > other than using AutoSeededRandomPool?? > > > (2) as a result from (1), i try to modify the coding by using time(NULL) as the > seed. (as show below) > ---------------------------------------------------------------------------------------------- > | Seed = time(0); //something like that > | ... > | RandomPool randPool; > | randPool.Put((byte *)Seed, strlen((char*)Seed)); > | RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength); > | HexEncoder privKey(new StringSink(secstring)); > | etc.. > ---------------------------------------------------------------------------------------------- > it's work. However, i discovered that, if two successive key generating happen very > closed to each other (>1second), they will generated the SAME key pairs (i > experience it before)! it is because the time(0) function returns the current > computer time(calender) in seconds, hence, if the time is less than, say, a second, > there will be no difference for the Seed of this two successive key generating. it > my simulation, the time for two succesive key generating always less than a second. > Q2: Can anyone suggests a better method to generate an auto seeded random number if > the succesive key generating happen so closed to each other?? > > really appreciate if someone can help me. > thanks in advance. > > Regards,
