RSA_generate_key(3) OpenSSL RSA_generate_key(3) NNAAMMEE RSA_generate_key_ex, RSA_generate_key - generate RSA key pair SSYYNNOOPPSSIISS #include int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); Deprecated: RSA *RSA_generate_key(int num, unsigned long e, void (*callback)(int,int,void *), void *cb_arg); DDEESSCCRRIIPPTTIIOONN _R_S_A___g_e_n_e_r_a_t_e___k_e_y___e_x_(_) generates a key pair and stores it in the RRSSAA structure provided in rrssaa. The pseudo-random number generator must be seeded prior to calling _R_S_A___g_e_n_e_r_a_t_e___k_e_y___e_x_(_). The modulus size will be of length bbiittss, and the public exponent will be ee. Key sizes with nnuumm < 1024 should be considered insecure. The exponent is an odd number, typically 3, 17 or 65537. A callback function may be used to provide feedback about the progress of the key generation. If ccbb is not NNUULLLL, it will be called as follows using the _B_N___G_E_N_C_B___c_a_l_l_(_) function described on the _B_N___g_e_n_e_r_- _a_t_e___p_r_i_m_e(3) page. +o While a random prime number is generated, it is called as described in _B_N___g_e_n_e_r_a_t_e___p_r_i_m_e(3). +o When the n-th randomly generated prime is rejected as not suitable for the key, BBNN__GGEENNCCBB__ccaallll((ccbb,, 22,, nn)) is called. +o When a random p has been found with p-1 relatively prime to ee, it is called as BBNN__GGEENNCCBB__ccaallll((ccbb,, 33,, 00)). The process is then repeated for prime q with BBNN__GGEENNCCBB__ccaallll((ccbb,, 33,, 11)). RSA_generate_key is deprecated (new applications should use RSA_gener- ate_key_ex instead). RSA_generate_key works in the same way as RSA_gen- erate_key_ex except it uses "old style" call backs. See _B_N___g_e_n_e_r_- _a_t_e___p_r_i_m_e(3) for further details. RREETTUURRNN VVAALLUUEE If key generation fails, _R_S_A___g_e_n_e_r_a_t_e___k_e_y_(_) returns NNUULLLL. The error codes can be obtained by _E_R_R___g_e_t___e_r_r_o_r(3). BBUUGGSS BBNN__GGEENNCCBB__ccaallll((ccbb,, 22,, xx)) is used with two different meanings. _R_S_A___g_e_n_e_r_a_t_e___k_e_y_(_) goes into an infinite loop for illegal input values. SSEEEE AALLSSOO _E_R_R___g_e_t___e_r_r_o_r(3), _r_a_n_d(3), _r_s_a(3), _R_S_A___f_r_e_e(3), _B_N___g_e_n_e_r_a_t_e___p_r_i_m_e(3) HHIISSTTOORRYY The ccbb__aarrgg argument was added in SSLeay 0.9.0. 1.0.2u 2019-12-20 RSA_generate_key(3)