> I have an application encryting the data using RSA algorithm.
> I am using the encrypted data and want to decrypt the data to get plaintext.
> For this I am calling a RSA_private_decrypt() open ssl call in my C file.
> The publickey size is 2048bytes. The ciphertext passed from application is
> 246bytes around and the mod len of the key iam getting as 128. because of
> this i am getting the error as :
> error:0406506C:rsa routines:RSA_EAY_PRIVATE_DECRYPT:data
> greater than mod len
> I dont have control on the ciphertext. I have to provide the user-name on the
> application UI and it has the intelligency to encrypt it using RSA algorithm.
> How can I get this work.
> An further information required I can post.
Do you have some kind of specification that states how RSA is supposed to be used to encrypt the data? RSA all by itself is not a useful general-purpose encryption algorithm. It has to be part of some system that species how the plaintext is prepared, how the data is padded, and so on.
If you're just winging this without a specification, it's not surprising that it won't work right. (And even if it does work right, odds are it won't be secure.)