# Method Crypto.RSA.State()->generate_key()

Method generate_key

  ``this_program` generate_key(`int(128..)` `bits`, `void`|`int`|`Gmp.mpz` `e`)`

Description

  Generate a valid RSA key pair with the size bits using the random function set with set_random(). The public exponent e will be used, which defaults to 65537. Keys must be at least 89 bits.

Method generate_key

  ``variant` `__deprecated__` `this_program` generate_key(`int(128..)` `bits`, `function`(`int(0..)`:`string(8bit)`) `rnd`)`

Description

  Compatibility with Pike 7.8.