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

Method generate_key

  `variant this_program generate_key(int p_bits, int q_bits)`

Description

  Generates DSA parameters (p, q, g) and key (x, y). Depending on Nettle version q_bits can be 160, 224 and 256 bits. 160 works for all versions.

Method generate_key

  `variant this_program generate_key()`

Description

  Generates a public/private key pair. Needs the public parameters p, q and g set, either through set_public_key or generate_key(int,int).