i’m using this portion of code
char encrypted_text[1024];
RSA_public_encrypt(sizeof(message), message, encrypted_text, rsa, RSA_PKCS1_OAEP_PADDING);
printf("encrypted text: %s\n", encrypted_text);
and the optput is something like this:
�v0��뷾��s�E�Z��N\����6~��:�&���� /����~ͯ���L��d�Ǡ��
E��[�h�U.vH2F1Qb^)�g� ,a�Ҩ�x vU|�>�ˢ=W�ő��
�\��g
it’s possible to eliminate � symbols??
The string isn’t printing well because it’s binary data, not text. It’s not meant to be human readable.
A common way to make binary data text-friendly is to base64 encode it. Base64 encoding converts binary data into a string of ASCII characters. The encoded text still isn’t human readable, so it’ll still look like gobbledygook when you print it, but it’ll at least be easy on the eyes, easy to paste into text files, easy to e-mail around.
See this Stack Overflow question for ways to do base64 encoding/decoding in C.