0

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 ?

Silicium
  • 31
  • 5

1 Answers1

0

I would check out the example program o_p_test (I believe in programs/test/) in PolarSSL. It shows PolarSSL RSA encryption and OpenSSL encryption side by side..

I believe the OpenSSL wrapper is older and not maintained..

Joe
  • 1