Unverified Commit 0d8128ad authored by kladko's avatar kladko

bug/SKALE-3751-enable-zeromq

parent 3ced7e60
......@@ -43,6 +43,8 @@ shared_ptr <ZMQMessage> ZMQClient::doRequestReply(Json::Value &_req) {
if (sign) {
CHECK_STATE(!certificate.empty());
CHECK_STATE(!key.empty());
_req["cert"] = certificate;
_req["msgSig"] = "haha";
}
......@@ -122,6 +124,12 @@ string ZMQClient::doZmqRequestReply(string &_req) {
}
string ZMQClient::readFileIntoString(const string& _fileName) {
ifstream t(_fileName);
string str((istreambuf_iterator<char>(t)), istreambuf_iterator<char>());
return str;
}
ZMQClient::ZMQClient(const string &ip, uint16_t port, bool _sign, const string &_certFileName,
const string &_certKeyName) : ctx(1), sign(_sign),
certKeyName(_certKeyName), certFileName(_certFileName) {
......@@ -132,11 +140,13 @@ ZMQClient::ZMQClient(const string &ip, uint16_t port, bool _sign, const string &
CHECK_STATE(!_certFileName.empty());
CHECK_STATE(!_certKeyName.empty());
ifstream t(_certFileName);
string str((istreambuf_iterator<char>(t)), istreambuf_iterator<char>());
certificate = str;
certificate = readFileIntoString(_certFileName);
CHECK_STATE(!certificate.empty());
key = readFileIntoString(_certKeyName);
CHECK_STATE(!key.empty());
} else {
CHECK_STATE(_certFileName.empty());
CHECK_STATE(_certKeyName.empty());
......
......@@ -49,6 +49,8 @@ private:
string certFileName = "";
string certKeyName = "";
string certificate = "";
string key = "";
recursive_mutex mutex;
......@@ -66,6 +68,7 @@ private:
uint64_t getProcessID();
static string readFileIntoString(const string& _fileName);
public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment