RSA_size(rsa)
returns modulus which equals to 256 in my application.
and I am encrypting the data with RSA_PKCS1_OAEP_PADDING
option, so the max length of the input buffer sent to RSA_public_encrypt()
is 256 - 41 = 215
In some case, the length of my input buffer may exceeds the 215 limitation a bit, and I need call RSA_public_encrypt()
multitimes.
My question is about the return value of RSA_public_encrypt()
.
From my test the return value is 256 (equals to RSA_size(rsa)
),
and the doc also says:
RSA_public_encrypt() returns the size of the encrypted data (i.e., RSA_size(rsa)).
I just want to make sure that there will only be two possibilities for the return value of RSA_public_encrypt()
.
-1 (error) or modulus(success), and there is no other possiblity, yes?
I am curious because I need dividing the encrypted buffer and call RSA_private_decrypt()
for each of the block. If the encrypted buffer of each RSA_public_encrypt
is the same, then I don't need store the size for each of them.