RSA和Perl – 如何实现随机性?

关于如何实现随机性,Crypt :: OpenSSL :: RSA的文档似乎含糊不清.例如,是否必须呼叫

Crypt::OpenSSL::RSA->import_random_seed();

每次打电话之前

Crypt::OpenSSL::RSA->generate_key

或者甚至可以调用import_random_seed,即使多次调用generate_key也是如此?

那么Crypt :: OpenSSL :: Random :: random_seed($good_entropy)呢?如果有/ dev / random,据说没有必要,但是如果它是Windows的呢?

我正在寻找有使用经验的人的建议.

最佳答案 Crypt :: OpenSSL :: RSA附带了一些信息
in one of the test files.

On platforms without a /dev/random, we need to manually seed. In
real life, the following would stink, but for testing purposes, it
suffices to seed with any old thing, even if it is not actually
random. We’ll at least emulate seeding from Crypt::OpenSSL::Random,
which is what we would have to do in “real life”, since the private
data used by the OpenSSL random library apparently does not span
across perl XS modules.

所以你必须使用那些东西并在Windows设备上添加更多随机随机性.

点赞