hu_RSAPublicEncrypt()

Produces an output block by applying the basic RSA primitive on an input block using a public key.

Synopsis:

#include "hursa.h"
 
int hu_RSAPublicEncrypt(sb_Params rsaParams, sb_PublicKey publicKey, const unsigned char *input, unsigned char *output, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

rsaParams

An RSA parameters object.

publicKey

An RSA public key object.

input

The input buffer. This must be equal to the modulus length.

output

The output buffer. This must be equal to the modulus length.

sbCtx

A global context.

Library:

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

Description:

The mathematical operation performed is raising the input value to the public exponent modulo the modulus.

The input value, treated as the octet string encoding of an integer, must be numerically smaller than the modulus.

The input and output buffers may point to the same address.

The length of the modulus can be determined by calling hu_RSAKeyGet() and retrieving the nLen argument.

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_PUBLIC_KEY

The publicKey object is NULL.

SB_ERR_BAD_PUBLIC_KEY

The publicKey object is invalid.

SB_ERR_NULL_INPUT_BUF

The input buffer is NULL.

SB_ERR_NULL_OUTPUT_BUF

The output buffer is NULL.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.