hu_RSAPKCS1v15NoHashVerify()

Verifies a PKCS#1 v1.5 signature on the given message digest.

Synopsis:

#include "hursa.h"
 
int hu_RSAPKCS1v15NoHashVerify(sb_Params rsaParams, sb_PublicKey publicKey, int hashAlgId, size_t digestLen, const unsigned char *digest, size_t signatureLen, const unsigned char *signature, int *result, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

rsaParams

An RSA parameters object.

publicKey

An RSA public 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 equal to the modulus length.

signature

The signature value.

result

Verification result. This is non-zero if the signature is valid; otherwise this is zero, meaning that the signature is invalid.

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-Verify 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 specified digest algorithm does not match the algorithm encoded in the signature, an error will be returned.

If the signature is valid for the given digest, this function will return SB_SUCCESS and set result to a non-zero value.

If the signature is not valid for the given digest, this function may return SB_SUCCESS but result will be set to zero.

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 public key object is NULL.

SB_ERR_BAD_PUBLIC_KEY

The public 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_SIGNATURE

The signature buffer is NULL.

SB_ERR_BAD_SIGNATURE_LEN

The length of the signature buffer is invalid.

SB_ERR_BAD_HASH_TYPE

The message digest algorithm identifier is invalid.

SB_FAIL_BAD_PADDING

The signature was not properly padded.

SB_ERR_NULL_OUTPUT

The verification result pointer is NULL.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.