Encrypt data in a single part.
#include <smartcard/sc_smart_card.h>
sc_response_code_t sc_encrypt(sc_context_t *context,
const unsigned char *plaintext,
size_t plaintext_length,
unsigned char *ciphertext,
size_t *ciphertext_length)
BlackBerry 10.2.0
The active smart card context. This value cannot be NULL.
The input buffer that contains the plaintext to be encrypted. This value cannot be NULL.
Length of the plaintext buffer.
The output buffer where the ciphertext data is written. If the value is NULL, only ciphertext length is returned.
On input, the length of the ciphertext buffer. On output, the ciphertext length. This value cannot be NULL.
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 encryption initialization (sc_encrypt_init()) before performing each encryption 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.
SC_SCARD_S_SUCCESS upon success, an error code otherwise. See sc_response_code_t for defined error codes.