Decrypts a single ciphertext block by applying the PKCS#1 v2.1 RSAES-OAEP-Decrypt operation with SHA-1 and MGF1.
#include "hursa.h"
int hu_RSAPKCS1v21SHA1Decrypt(sb_Params rsaParams, sb_PrivateKey privateKey, size_t addInfoLen, const unsigned char *addInfo, size_t ciphertextLen, const unsigned char *ciphertext, size_t *plaintextLen, unsigned char *plaintext, sb_GlobalCtx sbCtx)
BlackBerry 10.0.0
An RSA parameters object.
An RSA private 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 ciphertext buffer. This must be equal to the modulus length.
The ciphertext buffer.
The length (in bytes) of the plaintext buffer. This will be at most the modulus length minus 42.
The plaintext buffer.
A global context.
If the length of the plaintext is known, a pointer to a buffer large enough to hold the plaintext should be passed in plaintext and its length in plaintextLen. This function will copy the plaintext into plaintext and set the actual length of the plaintext in plaintextLen.
If plaintext is NULL, or plaintext is not NULL but plaintextLen is too small, this function will set the maximum length of the plaintext in plaintextLen.
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 private key object is NULL.
The private key object is invalid.
The message label is NULL.
The ciphertext buffer is NULL.
The ciphertext buffer length is invalid.
The plaintext buffer length is NULL.
The plaintext buffer length is invalid.
The decrypted data is incorrectly padded or addInfo does not match what was used to generate the ciphertext.
Memory allocation failure.
Success.