> Hi all, > > thanks for your help on DH stuff :-) > Now I have a pb with RSA_sign(). > > I have a buffer and I want to sign it with my private key. > > So I generate a key: > > openssl genrsa -out key.pem 1024 > > then I have the following code: > > " > rsa = RSA_new(); > get_my_priv_RSA(&rsa); > > sigbuf = malloc(RSA_size(rsa)); > > length_buffer = 99; > > if (RSA_sign(NID_md5, > buf, > length_buffer, > sigbuf, > &siglen, > rsa) != 1) { > printf("Error while signing buffer..\n"); > error = ERR_get_error(); > if (error != NULL) { > ERR_error_string(error, error_buf); > printf("%s\n", error_buf); > } > } > " > I have no pb with "get_my_priv_RSA()" > > but what is strange is that if length_buffer >= 100 then I have the > following errors :
The input to RSA_sign() must be smaller than BN_num_bytes(rsa->n) minus PKCS#1 padding bytes and some bytes for the asn1 digest encoding. [...] > so I don't understand what is going on with the value 100...and more I > don't know how to sign my real buffer (length ~= 500 octets) Hash your buffer and then sign the hash value with RSA_sign() ( or better : use the EVP_Sign* functions ). Nils ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]