I'm using openssl libraryes on client/server application, and i need to share public key with client. this is the struct of packet:
typedef struct pack {
char op[10];
char message[1024];
int id;
}packet;
and this is how extract the public key and put it in message field:
packet *send_pack
RSA *rsa,
const unsigned char *my_public_key;
my_public_key = malloc(1024);
send_pack = (packet*) malloc(sizeof (packet));
rsa = RSA_new();
rsa = RSA_generate_key(1024, 17, NULL, NULL);
i2d_RSAPublicKey(rsa, &my_public_key);
printf("my public key: %X\n", (unsigned int)my_public_key);
strcpy(send_pack->message, my_public_key);
printf("field message of send pack %X", (unsigned int)send_pack->message );
...
but the two printf print two similar value, but not the same (for example the first printf return A0B9092 and the second A0B944 ). What's wrong ?