This function performs the first two steps of RSA KEM: generating a random number and encrypting it with a public key.
#include "hursa.h"
int hu_RSAKEMRawSecretEncrypt(sb_Params RSAParams, sb_PublicKey publicKey, size_t *secretLen, unsigned char *secret, size_t *ciphertextLen, unsigned char *ciphertext, sb_GlobalCtx sbCtx)
BlackBerry 10.0.0
RSA parameters object.
Public key object.
The length (in bytes) of the secret. On input, this must not less than the modulus length.
The buffer for the generated random number.
The length (in bytes) of the ciphertext. On input, this must not less than the modulus length.
Ciphertext.
Memory callback data.
If the secret or ciphertext buffer is set to NULL, the necessary length will be returned to secretLen or ciphertextLen.
If the length of the secret or ciphertext buffer is larger than necessary, this function will set secretLen or ciphertextLen to the right value upon return.
RSA parameters object is NULL.
RSA parameters object is invalid.
Public key object is NULL.
Public key object is invalid.
The rngCtx in RSAParams is NULL.
The secretLen or ciphertextLen is NULL.
The secretLen or ciphertextLen is shorter than necessary.
Memory allocation failure.
Success.