title: Generate every time same RSA key with c++
body: <p>I'm trying to generate every time same RSA key with <strong>RSA_generate_key_ex(...)</strong> and then write in file, but I always get different keys. Is there any turnkey solution or I need to write my own function for this? <strong>(I know that this is unsecure solution)</strong></p>
  
  <pre><code>char *passW = "password";
  RSA *rsa = RSA_new();
  
  BIGNUM *bn = BN_new();
  BN_bn2bin(bn, (unsigned char *)passW);
  BN_set_word(bn, RSA_3);
  
  OpenSSL_add_all_algorithms();
  RSA_generate_key_ex(rsa, 1024, bn, nullptr); 
  
  /* Save private key */
  FILE* fp = fopen("private.key", "w");
  PEM_write_RSAPrivateKey(fp, rsa, EVP_aes_256_cbc(), nullptr, 0, nullptr, &amp;passW);
  fclose(fp);
  </code></pre>
  
  <p>I expect same RSA key, if password matches.</p>