-   Linux - Security (
-   -   RSA public key encryption/private key decription (

koningshoed 08-05-2002 04:38 PM

RSA public key encryption/private key decription
Hallo all

I'm using the openssl package for a project I'm working on, and have come across the following in the RSA_public_encrypt man page.

"Raw RSA encryption. This mode should only be used to implement cryptographically sound padding modes in the application code. Encrypting user data directly with RSA is insecure."

What I would like to know is why this is insecure, and how does padding help. I've tried padding using RSA_PKCS1_OAEP_PADDING, but this causes data to encrypt to different "target" values. So say I encrypt the string "this string is to be encrypted" 5 or 6 times, I will end up with 5 or 6 different encrypted versions. For what I'm using it, this is not quite acceptable - the same string should encrypt to the same value each and every time (yes - this is probably slightly insecure - but it is needed). So what I did was pad whatever I get upto a multiple of 128 bytes with 0's (I still want to change this, based upon the input data pad it otherwise). Then encrypt each block of 128 bytes with no padding. Is this ok, or is it as the man pages suggest - REALLY BAD.

Thanks beforehand for all help


unSpawn 08-08-2002 07:25 AM

Maybe this, this or this can help.
*Citeseer has a *lot* of references, you just gotta know how to get to the actual text. Select a reference, select update, and the URI then is at the bottom of the page.

HTH somehow.

All times are GMT -5. The time now is 08:24 AM.