sc_sign()

Perform a signing operation.

Synopsis:

#include <smartcard/sc_smart_card.h>
 
sc_response_code_t sc_sign(sc_context_t *context,                 
                           const unsigned char *plaintext,                 
                           size_t plaintext_length,                 
                           unsigned char *signature,                 
                           size_t *signature_length)

Since:

BlackBerry 10.2.0

Arguments:

context

The active smart card context. This value cannot be NULL.

plaintext

The input buffer that contains the plaintext to be encrypted. This value cannot be NULL.

plaintext_length

Length of the plaintext buffer.

signature

The output buffer where the signature data will be written. if the value is NULL, only the signature length is returned.

signature_length

On input, the length of the signature buffer. On output, the signature length. This value cannot be NULL.

Library:

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

Description:

This function encrypts plaintext provided by the caller using RSA. Note that the caller is expected to provide padded plaintext, if required. PKCS 1.5 padding may be used for RSA. This function does not add or remove padding bytes.

Some card drivers require that you call initialization (sc_sign_init()) before performing each signing operation. Others do not. Depending on the card driver implementation, you may be able to call this function multiple times without re-initializing.

A handle of type SC_HANDLE_CARD_CRYPTO_PROVIDER_X must be allocated before calling this function, otherwise an error is returned.

Returns:

SC_SCARD_S_SUCCESS upon success, an error code otherwise. See sc_response_code_t for defined error codes.