Closed Ruth1993 closed 5 years ago
Hello @Ruth1993,
As far as I understand, you are trying to send cipher text between two parties. Did you get any error messages or exceptions during the execution? How did you create the channels?
Lior
Hi Lior,
Yes, I'm trying to send a ciphertext between two parties. When two parties send and receive messages using the above two functions, the receiving party gets a segmentation fault, which is due to the line c_m->initFromByteVector(raw_msg);
in the receive function. I already assumed something must be wrong there, but I can't figure out the proper way of parsing an IVCiphertext obtained over a communication channel.
I created the channel for both parties as follows (for the second party p1 and p2 are switched in the declaration of the channel object of course):
boost::asio::io_service io_service;
SocketPartyData p1 = SocketPartyData(boost_ip::address::from_string("127.0.0.1"), 8000);
SocketPartyData p2 = SocketPartyData(boost_ip::address::from_string("127.0.0.1"), 8001);
channel = make_shared<CommPartyTCPSynced>(io_service, p1, p2);
boost::thread t(boost::bind(&boost::asio::io_service::run, &io_service));
etc
Kind regards, Ruth
@Ruth1993 In the sender function, how did you init the SymmetricCiphertext
?
@liorko87 I have an AES object, initialized by make_shared<OpenSSLCTREncRandomIV>("AES")
, which encrypts a ByteArrayPlaintext
object using its default encrypt function, so I assume it returns an IVCiphertext
object.
I managed to fix the issue. I found a bug in the function toString() in class IVCiphertext, for which I created a pull request. Also, I found a bug in my own code (c_m needs to initialized), so I defined the function for receiving AES messages as follows (sending functions stays the same):
shared_ptr<SymmetricCiphertext> recv_aes_msg() {
vector<byte> empty;
shared_ptr<SymmetricCiphertext> c_m = make_shared<IVCiphertext>(make_shared<ByteArraySymCiphertext>(empty), empty);
vector<byte> raw_msg;
channel->readWithSizeIntoVector(raw_msg);
const byte* uc = &(raw_msg[0]);
string msg = string(reinterpret_cast<char const*>(uc), raw_msg.size());
c_m->initFromString(msg);
return c_m;
}
Hello!
I have a question about sending an IVCiphertext over a communication channel. So I used the communication layer as provided by libscapi. Now I want to send an IVCiphertext from one party to the other over this communication channel. However, I get a segmentation fault and I can't figure out what's the problem. My functions for sending and receiving are as follows:
Send function:
Receive function:
I have implemented similar functions for ElGamal ciphertexts and ElGamal keys, and in those cases I used the libscapi function for generating sendable data and it works. However, there is no such function for symmetric ciphertexts, so that's why I tried it this way, but apparently it doesn't work.
Could anyone help me out? Thanks a lot!
Kind regards, Ruth