Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ciphertext length longer than mod len

3,460 views
Skip to first unread message

ambika cp

unread,
Feb 8, 2010, 12:21:26 AM2/8/10
to
Hi,

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. Please any suggestions are welcome.

Regards
Ambika

Edgar Ricardo Gonzalez Lazaro

unread,
Feb 8, 2010, 9:51:07 PM2/8/10
to
Have you tried without padding (RSA_NO_PADDING) or may be RSA_PKCS1_PADDING or RSA_PKCS1_OAEP_PADDING

;-)

Greetings!

2010/2/7 ambika cp <ambika...@rediffmail.com>



--
"Hay que darle un sentido a la vida por el hecho mismo de que la vida carece de sentido."

David Schwartz

unread,
Feb 9, 2010, 1:48:12 PM2/9/10
to

ambika cp wrote:

> 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.)

DS

______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openss...@openssl.org
Automated List Manager majo...@openssl.org

Richard Roe

unread,
Mar 11, 2021, 5:36:38 PM3/11/21
to
Asymmetric RSA keys can encrypt/decrypt only data of limited length i.e. RSAES-PKCS1-v1_5 encryption scheme defined in RFC3447 can operate on messages of length up to k - 11 octets (k is the octet length of the RSA modulus) so if you are using 2048-bit RSA key then maximum length of the plain data to be encrypted is 245 bytes. Try RSA_PKCS1_PADDING to fix this.

Goku Zeus

unread,
Jan 16, 2023, 11:25:16 AM1/16/23
to
Chicken wings, long thought to be garbage, have become the ultimate bar dish, and some of America's greatest chefs are upgrading them even more with complex tastes, new twists, and cooking methods once reserved for fine-dining kitchens. https://www.theamericanbulletin.com/the-americas-best-wings/
0 new messages