hu_RSAKEMRawSecretDecrypt()

Decrypt the ciphertext with a private key:

Synopsis:

#include "hursa.h"
 
int hu_RSAKEMRawSecretDecrypt(sb_Params RSAParams, sb_PrivateKey privateKey, size_t ciphertextLen, const unsigned char *ciphertext, size_t *secretLen, unsigned char *secret, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

RSAParams

RSA parameters object.

privateKey

Private key object.

ciphertextLen

The length (in bytes) of the ciphertext. This must be equal to the modulus length.

ciphertext

Ciphertext.

secretLen

The length (in bytes) of the secret. On input, this must not less than the modulus length.

secret

The buffer for the decryption result

sbCtx

Memory callback data.

Library:

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

Description:

If the secret buffer is set to NULL, its necessary length will be returned to secretLen.

If the length of the secret buffer is larger than necessary, this function will set secretLen to the right value upon return.

Returns:

SB_ERR_NULL_PARAMS

RSA parameters object is NULL.

SB_ERR_BAD_PARAMS

RSA parameters object is invalid.

SB_ERR_NULL_PRIVATE_KEY

Private key object is NULL.

SB_ERR_BAD_PRIVATE_KEY

Private key object is invalid.

SB_ERR_NULL_OUTPUT_BUF_LEN_PTR

The secretLen is NULL.

SB_ERR_BAD_INPUT_BUF_LEN

The secretLen or ciphertextLen is shorter than necessary.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.