Encrypts a single plaintext block by applying the PKCS#1 v2.1 RSAES-OAEP-Encrypt operation with SHA-1 and MGF1.
#include "hursa.h"
int hu_RSAPKCS1v21SHA1Encrypt(sb_Params rsaParams, sb_PublicKey publicKey, size_t addInfoLen, const unsigned char *addInfo, size_t plaintextLen, const unsigned char *plaintext, size_t *ciphertextLen, unsigned char *ciphertext, sb_GlobalCtx sbCtx)
BlackBerry 10.0.0
An RSA parameters object.
An RSA public key object.
The length (in bytes) of the message label. (Optional)
The label to be associated with the message. (Optional - set to NULL if not used.)
The length (in bytes) of the plaintext buffer. This must be at most the modulus length minus 42.
The plaintext buffer.
The length (in bytes) of the ciphertext buffer. This must be at least the modulus length.
The ciphertext buffer.
A global context.
The RSA parameter object must have been created with an RNG context.
If the length of the ciphertext is known, a pointer to a buffer large enough to hold the ciphertext should be passed in ciphertext and its length in ciphertextLen. This function will copy the ciphertext into ciphertext and set the actual length of the ciphertext in ciphertextLen.
If ciphertext is NULL, then this function will set the correct length of the ciphertext value in ciphertextLen. If ciphertext is not NULL but ciphertextLen is too small, this function will return an error.
The length of the modulus can be determined by calling hu_RSAKeyGet() and retrieving the nLen argument.
The rsaParams object is NULL.
The tag for the params object is not of the expected type.
The public key object is NULL.
The public key object is invalid.
The message label is NULL.
The plaintext buffer is NULL.
The plaintext buffer length is too large.
The ciphertext buffer length is NULL.
The ciphertext buffer length is invalid.
Memory allocation failure.
Success.