Function silc_create_key_pair
SYNOPSIS
bool silc_create_key_pair(const char *pkcs_name,
SilcUInt32 key_len_bits,
const char *pub_filename,
const char *prv_filename,
const char *pub_identifier,
const char *passphrase,
SilcPKCS *return_pkcs,
SilcPublicKey *return_public_key,
SilcPrivateKey *return_private_key,
bool interactive);
DESCRIPTION
This routine can be used to generate new public key and private key
pair. The `pkcs_name' is the name of public key algorithm, or if
NULL it defaults to "rsa". The `key_len_bits' is the key length
in bits and if zero (0) it defaults to 2048 bits. The `pub_filename'
and `prv_filename' is the public key and private key filenames.
The `pub_identifier' is the public key identifier (for example:
"UN=foobar, HN=hostname"), or if NULL the routine generates it
automatically.
The `passphrase' is the passphrase that is used to encrypt the
private key file. It is recommended that you would protect your
private key file with a passphrase.
The routine returns FALSE if error occurs during key generation.
Function returns TRUE when success and returns the created SilcPKCS
object, which can be used to perform public key cryptography into
`return_pkcs' pointer, created public key into `return_public_key',
and created private key into `return_private_key' pointer.
If the `interactive' is TRUE then this asks the user (by blocking
the process for input) some questions about key generation (like
public key algorithm, key length, filenames, etc). If all
arguments are provided to this function already then `interactive'
has no effect.
NOTES
Before calling this function the application must have initialized
the crypto library by registering the public key algorithms with
silc_pkcs_register_default function.
|