Behaves identical to the legacy counterpart rsa_generate_keypair_mem() except that it allows the caller to specify the cipher used to encrypt the private key (the legacy function always uses des-ede3-cbc).
rsa_generate_keypair_mem_cipher( pubkey var, privkey var, bits, e, passphrase, ciphername )
Returns 1 on success or 0 on error.
pubkey = The variable which receives the generated public key
privkey = The variable which receives the generated private key
bits = The RSA modulus size, in bits
e = The public key exponent. Must be an odd number, typically 3, 17 or 65537
passphrase = The passphrase used to encrypt the private key
ciphername = an OpenSSL cipher identifier, such as "aes-128-cbc"
This function generates an RSA keypair, storing the public and private components in files in the variables specified. The public key is encoded using a PKCS#1 RSAPublicKey structure. The private key is encrypted with the specified cipher using the provided passphrase and stored in in PKCS#8 EncryptedPrivateKeyInfo format using PKCS#5 v2.0 password based encryption algorithms. Note that OpenSSL only permits a subset of its supported ciphers to be used for RSA key encryption. For example, only CBC mode ciphers are permitted.