Hi!

I tired to use RSA encryption.


unsigned char *rsa_in = "Very secret message Very secret message Very secret m";

OpenSSL_add_all_algorithms();
pad = RSA_PKCS1_PADDING;
rsa_inlen = strlen(rsa_in);
printf ("rsa_inlen:%d\n",rsa_inlen);

rsa = RSA_generate_key(512,RSA_F4,NULL,NULL);
keysize = RSA_size(rsa);
printf ("Keysize:%d\n",keysize);
rsa_out = OPENSSL_malloc(keysize);

rsa_outlen  = RSA_public_encrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad);
printf ("rsa_outlen:%d\n",rsa_outlen);
}//end

output :
rsa_inlen:53
Keysize:64
rsa_outlen:64

is good, but if:
unsigned char *rsa_in = "Very secret message Very secret message Very
secret me";
.....

rsa_inlen:54
Keysize:64
rsa_outlen:-1

why? rsa_inlen is 53: working correctly
rsa_inlen is 54 or above: segmentation fault.

how to do RSA encrypt with very long string, or with file???

king regards,
 mark
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to