hu_RSAKeyGen()

Creates an RSA private and public key object from random data.

Synopsis:

#include "hursa.h"
 
int hu_RSAKeyGen(sb_Params rsaParams, size_t eLen, const unsigned char *e, sb_PrivateKey *privateKey, sb_PublicKey *publicKey, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

rsaParams

An RSA parameters object.

eLen

The length (in bytes) of the public exponent. (Optional)

e

The public exponent. (Optional - set to NULL if the default value should be used.)

privateKey

The private key object pointer.

publicKey

The public key object pointer.

sbCtx

A global context.

Library:

libhuapi (For the qcc command, use the -l huapi option to link against this library)

Description:

If the public exponent is not supplied (i.e. set to NULL), this function will assume a default value of 65537 (0x10001).

Returns:

SB_ERR_NULL_PARAMS

The rsaParams object is NULL.

SB_ERR_BAD_PARAMS

The tag for the params object is not of the expected type.

SB_ERR_NULL_OUTPUT

The private and/or public key object pointers are NULL.

SB_ERR_BAD_RSA_E_LEN

The length of the public exponent is invalid.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.