In this code:
int encrypted_length = RSA_public_encrypt (lenPlainText, plainText, encrypted, rsa, padding);
int encrypted_length2 = strlen((char *) encrypted);
Using same plainText Sometimes (only Sometimes) this two lengthes doesnt match;
Both should always be 256.
Always the first (encrypted length) shows 256. Both the second sometimes shows smaller quantities.
And when that happens the key appears truncated if I try to show it on the output.
I imagine the unsigned char "encrypted" sometimes comes with zeros (null) and so it's truncating.
This can happen?