I am encrypting a message using RSA.
Everything works fine if I try to encrypt/decrypt the message locally, however, when converting the string to void constant*
in order to use the socket::send
method like so,
int sendRes = send(socket, tempMessage.c_str(), tempMessage.size() + 1, 0);
the following happens,
My original string, tempMessage
"_��JE<D�p�-d�R�U���`}�+�;���|[�t�Ԕ���^;D�Mn��?ÕW>�-�6���Pr��[͉dZ%�"
is truncated to this, when using tempMessage.c_str()
"_��JE<D�p�-d�R�U���`}�+�;���|[�"
I do know this is because, during encryption, there is a \0
symbol that gets appended in between once or several times, terminating thus everything there when using c_str().
I also know it happens before using send(), I put it here so that you know why I am using c_str() in the first place.
It's there a way to bypass this? or a workaround?
I have seen this previous answer but did not help with my situation and could not find any other solution out there.
Thanks in advance for the help!