I must change OpenSSL library to PolarSSL in my project, but i have some troubles. When i encrypt my session key with function below from from OpenSSL library
RSA_public_encrypt((const int)session_key_len,(const unsigned char*) session_key
, (unsigned char*)encrypted_session_key, ctx->server_pubkey
, RSA_PKCS1_PADDING);
The remote server will authorize me successfully. But if I use OpenSSL wrapper from PolarSSL library, I receive different encrypted_session_key and remote server refused the connection.
RSA server public key size: 2048 bits. Session key length: 64 bytes. Encrypted key length: 256 bytes.
Whats wrong? Whats difference between function RSA_public_encrypt from OpenSSL and function rsa_pkcs1_encrypt from PolarSSL ?