Closed juy13 closed 3 years ago
Hi @juy13,
Check the utilities we have in https://github.com/homenc/HElib/tree/master/utils The "create context" util show how to create a context, PK and SK, serializes those to a file; The "encrypt" utils show how you can load the PK for encryption; The "decrypt" shows how to load the SK for decryption.
Thank you! It works now
Hi, I want to share a PK with my server. However, if I use send/recv from standart library, I can't build key on server (it was a segmentation fall). On client:
char *buffer = static_cast<char*>(static_cast<void*>(&public_key));
connect(sock, (struct sockaddr *)&addr, sizeof(addr));
send(sock, buffer, sizeof(public_key), 0);
On server:bytes_read = recvfrom(sock, buf, 1024, 0, NULL, NULL);
if(bytes_read > 0)
{
helib::PubKey *public_key = (static_cast<helib::PubKey *>(static_cast<void*>(buf)));
break;
}
In addition I tried
void writePubKeyBinary(std::ostream& str, const PubKey& pk);
void readPubKeyBinary(std::istream& str, PubKey& pk);
but it didn't help, because I need initialize PK previously, but I can't do it due to the fall against Can you help me, please?