rsa_generate_keypair_mem_cipher()#
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.
Syntax
rsa_generate_keypair_mem_cipher( pubkey var, privkey var, bits, e, passphrase, ciphername )
Returns#
Returns 1 if compilation succeeds, 0 if error occurred.
Parameters#
Parameter | Description |
---|---|
pubkey |
Variable that receives the generated public key (PKCS#1 RSAPublicKey). |
privkey |
Variable that receives the generated private key (PKCS#8 Encrypted format). |
bits |
RSA modulus size, in bits. |
e |
Public key exponent (must be odd; typically 3, 17, or 65537). |
passphrase |
Passphrase used to encrypt the private key. |
ciphername |
OpenSSL cipher identifier (e.g., "aes-128-cbc" ). Only certain ciphers (CBC mode) are permitted for RSA key encryption. |