Hi,
I'm trying to RSA-sign a string and I'm following the example in
http://cryptopp.sourceforge.net/docs/ref/test_cpp-source.html. There is
a function RSASignFile() there that I can adapt to use in-memory strings
instead of files. Problem is that when I use a NullRNG (I used
CryptoPP::NullRNG() because I couldn't find a class NullRNG as indicated
by the example), an exception is thrown (byte GenerateByte() {throw
NotImplemented("NullRNG: NullRNG should only be passed to functions that
don't need to generate random bytes");} ) because apparantly some
randomness is needed somewhere.
But when I replace the random generator with a 'real' RNG, it seems to work:
CryptoPP::RandomPool& GlobalRNG()
{
static CryptoPP::RandomPool randomPool;
return randomPool;
}
and then use 'GlobalRNG()' where the example said to instantiate a NullRNG.
The example does state '// RSASSA_PKCS1v15_SHA_Signer ignores the rng.
Use a real RNG for other signature schemes!', so I'm a bit confused why
the RNG is used after all.
My question is: should I just the RandomPool RNG? Why doesn't the sample
work, is there a different way to use a Null RNG?
I hope all of this makes sense, thanks in advance.
cheers,
roel