hu_RSAPKCS1v15NoHashSign()

Generates a signature on the given message digest by applying the PKCS#1 v1.5 signature scheme.

Synopsis:

#include "hursa.h"
 
int hu_RSAPKCS1v15NoHashSign(sb_Params rsaParams, sb_PrivateKey privateKey, int hashAlgId, size_t digestLen, const unsigned char *digest, size_t *signatureLen, unsigned char *signature, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

rsaParams

An RSA parameters object.

privateKey

An RSA private key object.

hashAlgId

The message digest algorithm identifier. The acceptable values are one of the SB_RSA_PKCS1_V15_SIG_* macros.

digestLen

The length (in bytes) of the message digest.

digest

The message digest.

signatureLen

The length (in bytes) of the signature. This must be at least the modulus length.

signature

The signature value.

sbCtx

A global context.

Library:

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

Description:

This function implements the operation known as RSASSA-PKCS1-v1_5-Sign in PKCS#1 v2.1.

This function assumes that the input is a message digest produced by the specified digest algorithm; no digest operation will be performed on the input.

If the length of the signature is known, a pointer to a buffer large enough to hold the signature should be passed in signature and its length in signatureLen. This function will copy the signature into signature and set the actual length of the signature in signatureLen.

If signature is NULL, or signature is not NULL but signatureLen is too small, this function will set the maximum length of the signature in signatureLen.

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_PRIVATE_KEY

The private key object is NULL.

SB_ERR_BAD_PRIVATE_KEY

The private key object is invalid.

SB_ERR_BAD_HASH_TYPE

The message digest algorithm identifier is invalid.

SB_ERR_NULL_INPUT_BUF

The message digest buffer is NULL.

SB_ERR_BAD_INPUT_BUF_LEN

The length of the message digest is invalid.

SB_ERR_NULL_OUTPUT_BUF_LEN_PTR

The length of the signature buffer is NULL.

SB_ERR_BAD_OUTPUT_BUF_LEN

The signature buffer is invalid.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.