Skip to content

rsa_generate_keypair()#


This function generates an RSA keypair, storing the public and private components in files in the files specified. The files are created in the Miva data directory. The public key is encoded using a PKCS#1 RSAPublicKey structure. The private key is encrypted using triple-DES in EDE mode with cipher block chaining (DES-EDE3-CBC) using the provided passphrase and stored in in PKCS#8 EncryptedPrivateKeyInfo format using PKCS#5 v2.0 password based encryption algorithms.

Syntax
rsa_generate_keypair( pubkey_file, privkey_file, bits, e, passphrase )

Returns#

Returns 1 if compilation succeeds, 0 if error occurred.

Parameters#

Parameter Description
pubkey_file Name of the file where the generated public key is stored.
privkey_file Name of the file where the generated private key is stored.
bits RSA modulus size, in bits.
e Public key exponent (must be an odd number, typically 3, 17, or 65537).
passphrase Passphrase used to encrypt the private key with 3DES (DES-EDE3-CBC).