当 OpenSSL 生成密钥时,这些点和加号是什么意思?

信息安全 openssl
2021-08-28 12:02:38

当 OpenSSL 生成密钥时,您总是会看到一系列句点/点 ( .) 和加号 ( +)。

openssl dhparam -text -noout -outform PEM -5 2048

……+…………+……………… ..................................................... ..................................................... ....................................+.................. ......+......+......+...... ..................................................... ..................................................... ..................................................... ....................+.................................. ..................................................... ..................................................... ......................+...................... ..................................................... ..................................................... .....+................................................ ..................................................... ....................+........+........ …………..................................................... ..................................................... ....+..+.................................................. ....................+.................................. ..................................................... ....................................+... ....................+.................................. ....................................+........ ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ....................................+.+...... ..................................................... ......................................+...... ..................................................... …………....................+........+........+........ ....................+.................................................. ....................+.................................. ..................................................... ....................+.................................................. ..................................................... ..................................................... ....................+................+................ ....................................+........ ..................................................... ………………+…………………………………………………………………………………………………… ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... …………..................................................... ..................................................... ........+.................................................. ....................+........ ..................................................... ..................................................... ..................................................... ....................................+.... ..................................................... ……+………………………………………………………………………… ....................+.................. ....................................+...... ..................................+................ ..................................................... ....................+................................ ..................................................... ..................................................... …………....................+..................+.................. ....................................+.... ..................................................... ..................................+................ ..................................................... ..................................................... .+................................................. ...................................+.. ......................+...................... ....................+..................+................ ..................................................... ......................................+....... ....................................+....+........ ..................................................... ..................................................... ..................................................... ....................+.................................................. …………........+............+...................... ..................................................... ..................................................... ......................+...................... ....................+.......+.......................+. ..................................................... ........+.................................................. ..................................................+ ..................................................... ..................................................... ......................................+...... ......................................+...... ..................................................... ....................+.................................. .....+................................................ ....................................+... ..................................................... …………..................................................... ..................................................... ....................+................................ ..................................................... ..................+................................ ......................+...................... ..................................................... ..................................................... ...+.......................+.................................. ..................................................... ..................................................... ..+..................................................+...... ..................................................... ....................+................................. ....................+.................................. ......................+...+...................... ..................................................... …………..+..................................+.. ....+........+........+........ ....................+................................. ..................+................................ ..................................................... ………………+…………………………………………………………………………………………………… ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ....................+................................ ....................................+.... ......................+.................................. ........+...................................... ..................+................................ …………....................................+..+........ ..................+................................ ..................................................... .................................................+. ....................+................................. ....................+.................................. ..................................................... .....................+................................ ....................+.+.................................. ..................+................................ ..................................................... ………………+…………………………………………………………………………………… ..................................................... ..................................................... ..................................................... ......................+...................... ..................................................... …………....................+..................+........ ..................................................... ..................................................... ........+..................................+........ ..................................................... ....................................+.................................+. ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ....................+................................ ……+…………+………… ..................................................... ……+……....................+........+........ ......................................+...... .....+................................+....++*++*

他们的意思是什么?

2个回答

在计算 DHPARAM 时,您将在计算Diffie Hellman参数时将这些作为输出:

. : A potential prime number was generated.
+ : Number is being tested for primality.
* : A prime number was found.

参考:

在 Diffie-Helman 参数生成的上下文中,.意味着已生成潜在素数。+表示通过了一次 Miller-Rabin 素性检验的迭代。*表示已找到满足 Miller-Rabin 素数检验的一次迭代的素数。

在默认条件下,为了生成至少 1300 位的素数,需要进行两次 Miller-Rabin 素数测试迭代。这就是为什么你看到++*++*最后。第一个+意味着素数p本身已经通过了 Miller-Rabin 素数检验的一次迭代。第二个+意味着 ( p -1)/2 也通过了 Miller-Rabin 素性检验的一次迭代。第一个*表示p和 ( p -1)/2 都通过了 Miller-Rabin 素性检验的迭代。

然后再次重新测试两者(因为BN_prime_checks_for_size(2048) == 2两次迭代),所以你又看到++*了。

由于p和 ( p -1)/2 都通过了素数测试的两次迭代,因此该过程停止并返回p

因此,如果您看到一个+,则表示生成的候选素数通过了素数测试的一次迭代,但 ( p -1)/2 没有。如果您看到++*但没有看到,++*++*则表示p和 ( p -1)/2 都通过了素性测试的第一次迭代,但其中一个失败了第二次迭代(这很可能对于 2048 位密钥和更长的密钥永远不会发生——a宇宙射线在计算过程中稍微翻转的可能性更大)。

参考: