ica_rsa_key_generate_mod_expo

Purpose

Generates RSA keys in modulus/exponent format.

Comments

This function allows users to generate RSA keys for any granularity in the range 57 - 4096 bits. For specific information about some of these parameters, see the considerations in Data structures.

Format


unsigned int ica_rsa_key_generate_mod_expo(ica_adapter_handle_t adapter_handle,
  unsigned int modulus_bit_length,
  ica_rsa_key_mod_expo_t *public_key,
  ica_rsa_key_mod_expo_t *private_key);

Parameters

ica_adapter_handle_t adapter_handle
Pointer to a previously opened device handle.
unsigned int modulus_bit_length
Length in bits of the modulus. This value should comply with the length of the keys (in bytes), according to this calculation:
key_length = (modulus_bits + 7) / 8
ica_rsa_key_mod_expo_t *public_key
Pointer to where the generated public key is to be placed. If the exponent element in the public key is not set, it is randomly generated. A poorly chosen exponent could result in the program looping endlessly. Common public exponents are 3 and 65537.
ica_rsa_key_mod_expo_t *private_key
Pointer to where the generated private key in modulus/exponent format is to be placed. The length of both the private and public keys should be set in bytes. This value should comply with the length of the keys (in bytes), according to this calculation:
key_length = (modulus_bits + 7) / 8

Return codes

0
Success
EPERM

Used RSA key is > 4K.

For return codes indicating exceptions, see Return codes.