ÃÖ¿ë»ï schrieb:
> 
> With reference to rsa.h,
> I found that there are four kinds of padding.
> Of them, My concern is about RSA_NO_PADDING and RSA_PKCS1_PADDING.
> 
> Basic assumption here is,
> 1. RSA Key size : 256

Just remember, this counts for 32 byte...

> 2. size of message to be encrypted : 33

...which would make it impossible to encrypt more then 32 byte
within one rsa operation.
 
> 1) in case of  RSA_NO_PADDING,
> 
> len = RSA_public_encrypt(what_number_here_?, from, to, rsa, RSA_NO_PADDING);

"what_number_here_?" is originally called fromlen and should
always be set to the lenght of the "from" buffer, containing
the message to be encrypted - in your caes 33.
 
> in this case, Shoud I provide this function with 32 for argument #1?
> and use for(while) loop to encrypt whole message?
> (SO, in this case, I should myself add padding to non-32-multiple length "from"?)

I suggest (as Bodo pointed out) as a newcomer to crypto you should
only use padded schemes. BTW 256 Bit is a terrible short key length!!!
 
> 2) in case of RSA_PKCS1_PADDING.
> len = RSA_public_encrypt(what_number_here_?, from, to, rsa, RSA_PKCS1_PADDING);
> 
> in this case, Should I provide this function with 32-11 for argument #1?
> and what is the return value of next ?

As before, provide with the original length (33) and make sure
you split the whole message block into pieces smaller then
32-11.

The best (and usually choosen) way is, as somebody already 
pointed out, use RSA to encrypt a temporary session key and use
this session key to encrypt the whole message.
 
> len = RSA_private_decrypt(32, to, from, rsa, RSA_PKCS1_PADDING);
> 
> Wish your help,
> fO.Ombar
> 
> ==================================================
> Æò»ý ¾²´Â ¹«·á E-mail ÁÖ¼Ò ÇѸÞÀϳÝ
> http://www.hanmail.net
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]

-- 
Holger Reif                  Tel.: +49 361 74707-0
SmartRing GmbH               Fax.: +49 361 7470720
Europaplatz 5             [EMAIL PROTECTED]
D-99091 Erfurt                    WWW.SmartRing.de
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to