�ֿ�� schrieb:
> 
> >>To answer your question it would be interesting which
> >>padding method (last parameter of the encrypt function)
> >>do you use and how long your RSA modulus is.
> >>
> >>�ֿ�� schrieb:
> >>>
> >>> Can RSA_public_encrypt() encrypt only 20-bytes long "from"?
> >>>
> >>> When I pass less than 20bytes string to it, it works well,
> >>> But, if I pass more than 20bytes string, it returns -1.
> >>>
> >>> And one more thing,
> >>> for less than 20byte-long input, it returns 32 always.
> >>> Is it right?
> >>>
> >>> I am working on Linux box.
> 
> Thanks for your information,
> padding is RSA_PKCS1_PADDING like below;

Then it is clear. Your modulus is obviously 32 Bytes (256 Bit) long.
The output will always have the same length as the modulus.

Second, the PKCS#1 formatting always adds at least 11 bytes of
formatting.
That's why you get the error about data to long. Have you tried popping
up the errors?

Perhaps the solution for you would be to use the RSA_NONE padding
method and make yourself sure that the buffer you want to encrypt
is equal the the size of the modulus.
 
> unsigned char from[BUFSIZ*10] = "Some text of which the length is big enough";
> int siz;
> unsigned char to[BUFSIZ*10];
> 
> siz = strlen(from);
> 
> RSA_public_encrypt(siz, from, to, pub_rsa, RSA_PKCS1_PADDING);
> 
> The same error occurs whether on Linux or on HP-UX.

No surprise ;-)

-- 
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
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to