Hi, the OpenSSL documentation tells : "RSA_public_encrypt() encrypts the flen bytes at from (usually a session key) using the public key rsa and stores the ciphertext in to. to must point to RSA_size(rsa) bytes of memory. "
I made a test and I saw something strange. I used theses arrays for my tests: unsigned char* test1 = new unsigned char[5]; test1[0] = 'a'; test1[1] = 'b'; test1[2] = 'c'; test1[3] = 'd'; test1[4] = 'e'; unsigned char* test2 = new unsigned char[4]; test2[0] = 'a'; test2[1] = 'b'; test2[2] = 'c'; test2[3] = 'd'; Here is my test: RSA_public_encrypt(4, test1, encryptedLine1, publicKey, RSA_PKCS1_PADDING); RSA_public_encrypt(4, test2, encryptedLine2, publicKey, RSA_PKCS1_PADDING); The two results (stored in encryptedLineX...) are not the same and I don't understand why. The first argument is not supposed to be the length (in bytes) of the data to be encrypted ? So in the two cases, the encryption is not supposed to bo on caracter 1 to 4 !? -- View this message in context: http://www.nabble.com/RSA_public_encrypt%28%29-strange-result-output...-is-it-a-bug-%21--tp21022467p21022467.html Sent from the OpenSSL - User mailing list archive at Nabble.com. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org