Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/group__random.html below:
NCBI C++ ToolKit: Random generation
◆ psa_generate_key()
Generate a key or key pair.
The key is generated randomly. Its location, usage policy, type and size are taken from attributes
.
Implementations must reject an attempt to generate a key of size 0.
The following type-specific considerations apply:
- For RSA keys (PSA_KEY_TYPE_RSA_KEY_PAIR), the public exponent is 65537. The modulus is a product of two probabilistic primes between 2^{n-1} and 2^n where n is the bit size specified in the attributes.
-
Note
-
This function is equivalent to calling psa_generate_key_custom() with the custom production parameters PSA_CUSTOM_KEY_PARAMETERS_INIT and `custom_data_length == 0` (i.e. `custom_data` is empty).
-
Parameters
-
[in] attributes The attributes for the new key. [out] key On success, an identifier for the newly created key. For persistent keys, this is the key identifier defined in
attributes
. 0
on failure.
-
Return values
-
◆ psa_generate_key_custom()
Generate a key or key pair using custom production parameters.
See the description of psa_generate_key() for the operation of this function with the default production parameters. In addition, this function supports the following production customizations, described in more detail in the documentation of psa_custom_key_parameters_t:
- RSA keys: generation with a custom public exponent.
-
Note
-
This function is experimental and may change in future minor versions of Mbed TLS.
-
Parameters
-
[in] attributes The attributes for the new key. [in] custom Customization parameters for the key generation. When this is PSA_CUSTOM_KEY_PARAMETERS_INIT with
custom_data_length
= 0, this function is equivalent to psa_generate_key(). [in] custom_data Variable-length data associated with custom
. custom_data_length Length of `custom_data` in bytes. [out] key On success, an identifier for the newly created key. For persistent keys, this is the key identifier defined in attributes
. 0
on failure.
-
Return values
-
◆ psa_generate_key_ext()
Generate a key or key pair using custom production parameters.
-
Note
-
This is a deprecated variant of psa_key_derivation_output_key_custom(). It is equivalent except that the associated variable-length data is passed in `params->data` instead of a separate parameter. This function will be removed in a future version of Mbed TLS.
-
Parameters
-
[in] attributes The attributes for the new key. [in] params Customization parameters for the key generation. When this is PSA_KEY_PRODUCTION_PARAMETERS_INIT with
params_data_length
= 0, this function is equivalent to psa_generate_key(). params_data_length Length of `params->data` in bytes. [out] key On success, an identifier for the newly created key. For persistent keys, this is the key identifier defined in attributes
. 0
on failure.
-
Return values
-
◆ psa_generate_random()
Generate random bytes.
-
Warning
-
This function **can** fail! Callers MUST check the return status and MUST NOT use the content of the output buffer if the return status is not PSA_SUCCESS.
-
Note
-
To generate a key, use psa_generate_key() instead.
-
Parameters
-
[out] output Output buffer for the generated data. output_size Number of bytes to generate and output.
-
Return values
-
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4