Skip to content
class method

OpenSSL::PKey.generate_parameters

OpenSSL::PKey.generate_parameters(algo_name [, options]) → pkey

Generates new parameters for the algorithm. algo_name is a String that represents the algorithm. The optional argument options is a Hash that specifies the options specific to the algorithm. The order of the options can be important.

A block can be passed optionally. The meaning of the arguments passed to the block varies depending on the implementation of the algorithm. The block may be called once or multiple times, or may not even be called.

For the supported options, see the documentation for the ‘openssl genpkey’ utility command.

Example

Example
pkey = OpenSSL::PKey.generate_parameters("DSA", "dsa_paramgen_bits" => 2048)
p pkey.p.num_bits #=> 2048