On Mon, Jul 19, 2010, anhpham wrote: > > Hi all :x > I encountered an error when using function RSA_private_encrypt with > RSA_NO_PADDING option. > I had an unsigned char array a with length = 20, RSA* r, > unsigned char* sig = (unsigned char*) malloc(RSA_size(r)) and then I invoked > function int i = RSA_private_encrypt(20,a ,sign,r,RSA_NO_PADDING ); The > returned value i = -1 means that this function failed. However, when I > invoked int i = RSA_private_encrypt(20,a,sig,r,RSA_PKCS1_PADDING ), it did > run smoothly. I'm confused whether it is an error of the library or not but > I don't know how to solve this problem. > Please help me :-<
If you use RSA_NO_PADDING you have to supply a buffer of RSA_size(r) bytes and whose value is less than the modulus. With RSA_PKCS1_PADDING you can pass up to RSA_size(r) - 11. Steve. -- Dr Stephen N. Henson. OpenSSL project core developer. Commercial tech support now available see: http://www.openssl.org ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org