Hello, I try to encrypt simple text with RSA algorithm. I have a problem with my code.
RSA *_RSA ;
unsigned char text[2560] = "A";
unsigned char sectext[2560];
unsigned char decrypttext[2560];
int i = 0;
_RSA = RSA_generate_key ( 1024, 65537, NULL, NULL );
i = RSA_public_encrypt ( 1, text, sectext, _RSA, RSA_PKCS1_OAEP_PADDING );
i = RSA_private_decrypt( 1, sectext, decrypttext, _RSA, RSA_PKCS1_OAEP_PADDING);
RSA_free ( _RSA );
The return value of RSA_public_encrypt is 128.
RSA_private_decrypt return -1. If I try to display decrypttext with cout i get nothing.
Thanks.